#www.521php.comserver{listen 80;server_name www.521php.com;rewrite ^(.*)$ https://$host$1 permanent;}server {listen 443 ssl;ssl_certificate /home/cert/521php.com_2022.crt;ssl_certificate_key /home/cert/521php.com_2022.key;server_name www.demo.com www.521php.com;location / {root /usr/share/nginx/html/521php; # 代码目录index index.html index.htm index.php; # 增加index.phptry_files $uri $uri/ /index.php?$args;}# error_page 404 /404.html;# location = /40x.html {# root /usr/share/nginx/html;# }# # redirect server error pages to the static page /50x.html# error_page 500 502 503 504 /50x.html;# location = /50x.html {# root /usr/share/nginx/html;# }location ~ \.php$ {root /var/www/521php; # 代码目录fastcgi_pass 521php_php:9000; # compose文件中nginx段设置的links的php名称fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # 修改为$document_rootinclude fastcgi_params;}}
本文档使用 521Wiki 发布