docker 配置php-nginx
2019-02-26 本文已影响0人
gurlan
docker-compose.yml
nginx:
container_name: web
image: docker.io/richarvey/nginx-php-fpm:latest
ports:
- 80:80
volumes:
- /data/projects/test/html:/data/www
- /data/projects/test/etc/nginx/conf.d/default.conf:/etc/nginx/sites-available/default.conf
- /data/projects/test/logs:/var/log/nginx
default.conf
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/qizuo.access.log ;
error_log /var/log/nginx/qizuo.error.log;
root /data/www/public;
index index.php index.html index.htm;
location / {
index index.htm index.html index.php;
try_files $uri $uri/ /index.php?s=$uri&$args;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
}