Configurar Laravel con Mysql en Docker
Versión 1 (Guillermo Zdanowicz, 04/01/2019 10:54)
1 | 1 | Guillermo Zdanowicz | h1. Configurar Laravel con Mysql en Docker |
---|---|---|---|
2 | 1 | Guillermo Zdanowicz | |
3 | 1 | Guillermo Zdanowicz | INSTALO DOCKER PARA MYSQL |
4 | 1 | Guillermo Zdanowicz | docker run --name automysql -v /home/backup/bdmysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root911 -d mysql:5.7 |
5 | 1 | Guillermo Zdanowicz | |
6 | 1 | Guillermo Zdanowicz | INSTALO DOCKER PARA NGINX VINCULANDO MYSQL |
7 | 1 | Guillermo Zdanowicz | docker run --name autodocker -d --link automysql:mysql -p 8080:80 -v "/home/projects/autogestion:/var/www/app:rw" --restart=always romeoz/docker-nginx-php:7.2 |
8 | 1 | Guillermo Zdanowicz | |
9 | 1 | Guillermo Zdanowicz | VERIFICO DOCKERS INSTALADOS |
10 | 1 | Guillermo Zdanowicz | sudo docker ps -a |
11 | 1 | Guillermo Zdanowicz | |
12 | 1 | Guillermo Zdanowicz | PARO DOCKER |
13 | 1 | Guillermo Zdanowicz | docker stop autodocker |
14 | 1 | Guillermo Zdanowicz | |
15 | 1 | Guillermo Zdanowicz | ELIMINO DOCKER |
16 | 1 | Guillermo Zdanowicz | docker rm autodocker |
17 | 1 | Guillermo Zdanowicz | |
18 | 1 | Guillermo Zdanowicz | INICIO DOCKER |
19 | 1 | Guillermo Zdanowicz | docker start autodocker |
20 | 1 | Guillermo Zdanowicz | |
21 | 1 | Guillermo Zdanowicz | EN SERVIDOR LOCAL BAJAR POR EJEMPLO EN /home/projects el codigo del repositorio |
22 | 1 | Guillermo Zdanowicz | |
23 | 1 | Guillermo Zdanowicz | BAJO DEL REPOSITORIO EL CODIGO |
24 | 1 | Guillermo Zdanowicz | git clone (link repositorio en este caso de llama autogestion la carpeta) |
25 | 1 | Guillermo Zdanowicz | |
26 | 1 | Guillermo Zdanowicz | docker run --name autodocker -d --link automysql:mysql -p 8080:80 -v "/home/projects/autogestion:/var/www/html:rw" --restart=always romeoz/docker-nginx-php:7.2 |
27 | 1 | Guillermo Zdanowicz | |
28 | 1 | Guillermo Zdanowicz | //INGRESO AL DOCKER DEL NGINX |
29 | 1 | Guillermo Zdanowicz | docker exec -ti autodocker bash |
30 | 1 | Guillermo Zdanowicz | |
31 | 1 | Guillermo Zdanowicz | INGRESO A LA CARPETA DEL SITIO |
32 | 1 | Guillermo Zdanowicz | /var/www/app |
33 | 1 | Guillermo Zdanowicz | |
34 | 1 | Guillermo Zdanowicz | |
35 | 1 | Guillermo Zdanowicz | ACTUALIZAMOS COMPOSER |
36 | 1 | Guillermo Zdanowicz | composer update |
37 | 1 | Guillermo Zdanowicz | |
38 | 1 | Guillermo Zdanowicz | CORRO SENTENCIA INICIAL DE LARAVEL |
39 | 1 | Guillermo Zdanowicz | php artisan key:generate |
40 | 1 | Guillermo Zdanowicz | |
41 | 1 | Guillermo Zdanowicz | ---------------------------------------------- |
42 | 1 | Guillermo Zdanowicz | DENTRO DEL autodocker CONFIGURAR EL ARCHIVO /etc/nginx/conf.d/default.conf |
43 | 1 | Guillermo Zdanowicz | |
44 | 1 | Guillermo Zdanowicz | |
45 | 1 | Guillermo Zdanowicz | /etc/nginx/conf.d/default.conf [----] 0 L:[ 1+23 24/ 80] *(572 /1900b) 0010 0x00A [*][X] |
46 | 1 | Guillermo Zdanowicz | |
47 | 1 | Guillermo Zdanowicz | server { |
48 | 1 | Guillermo Zdanowicz | listen 80; |
49 | 1 | Guillermo Zdanowicz | server_name localhost; |
50 | 1 | Guillermo Zdanowicz | |
51 | 1 | Guillermo Zdanowicz | root /var/www/app/public; |
52 | 1 | Guillermo Zdanowicz | index index.php; |
53 | 1 | Guillermo Zdanowicz | charset utf8; |
54 | 1 | Guillermo Zdanowicz | |
55 | 1 | Guillermo Zdanowicz | location /assets/ |
56 | 1 | Guillermo Zdanowicz | { |
57 | 1 | Guillermo Zdanowicz | location ~ \.(?:js|json|ts|css|scss|woff(?:2)?|ttf|map|ico|html|xml|swf|flv|pdf|xls|htc|svg|gif|jpg|png|jpeg)$ { |
58 | 1 | Guillermo Zdanowicz | log_not_found off; |
59 | 1 | Guillermo Zdanowicz | expires 90d; |
60 | 1 | Guillermo Zdanowicz | gzip on; |
61 | 1 | Guillermo Zdanowicz | gzip_static on; |
62 | 1 | Guillermo Zdanowicz | gzip_http_version 1.1; |
63 | 1 | Guillermo Zdanowicz | gzip_comp_level 8; |
64 | 1 | Guillermo Zdanowicz | gzip_types text/plain text/css application/x-javascript text/javascript; |
65 | 1 | Guillermo Zdanowicz | } |
66 | 1 | Guillermo Zdanowicz | |
67 | 1 | Guillermo Zdanowicz | return 404; |
68 | 1 | Guillermo Zdanowicz | } |
69 | 1 | Guillermo Zdanowicz | |
70 | 1 | Guillermo Zdanowicz | error_page 500 502 503 504 /50x.html; |
71 | 1 | Guillermo Zdanowicz | location = /50x.html { |
72 | 1 | Guillermo Zdanowicz | root /usr/share/nginx/html; |
73 | 1 | Guillermo Zdanowicz | } |
74 | 1 | Guillermo Zdanowicz | |
75 | 1 | Guillermo Zdanowicz | location / |
76 | 1 | Guillermo Zdanowicz | { |
77 | 1 | Guillermo Zdanowicz | try_files $uri $uri/ /index.php?$args; |
78 | 1 | Guillermo Zdanowicz | } |
79 | 1 | Guillermo Zdanowicz | |
80 | 1 | Guillermo Zdanowicz | location ~ \.php$ |
81 | 1 | Guillermo Zdanowicz | { |
82 | 1 | Guillermo Zdanowicz | try_files $uri =404; |
83 | 1 | Guillermo Zdanowicz | include fastcgi_params; |
84 | 1 | Guillermo Zdanowicz | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
85 | 1 | Guillermo Zdanowicz | fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; |
86 | 1 | Guillermo Zdanowicz | } |
87 | 1 | Guillermo Zdanowicz | |
88 | 1 | Guillermo Zdanowicz | } |