Nginx配置文件:nginx.conf文件
http {
server{
listen 80; # 监听的端口:80,可以修改。
listen 443 ssl; # 或者:listen 443 ssl http2;
server_name xcx.test.com; # 定义使用xcx.test.com访问,即浏览器输入的地址。
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/xcx.zun.com;
#SSL-START SSL的相关配置,请勿删除或修改下一行带注释的404规则。
#error_page 404/404.html;
ssl_certificate /www/server/panel/vhost/cert/xcx.test.com/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/xcx.test.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
error_page 497 https://$host$request_uri;
#SSL-END
# 想在HTML里插入PHP代码,然后直接访问HTML文件,执行里面的PHP代码。让html文件也作为PHP文件解析执行。每次执行html文件 会执行里面的php代码后并返回。
# 配置完之后还需要编辑php的配置文件(php-fpm.conf文件),指定html扩展名:security.limit_extensions = .php .php3 .php4 .php5 .html .png .htm
# 从5.3.9开始,php官方加入了一个配置"security.limit_extensions",默认状态下只允许执行扩展名为".php"的文件,造成了其他类型的文件不支持的问题。
location ~ \.php|\.html$ {
root /www/wwwroot/haidon.top;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/tmp/php-cgi-56.sock;
fastcgi_param SCRIPT_FILENAME /www/wwwroot/haidon.top$fastcgi_script_name;
fastcgi_index index.html;
include fastcgi_params;
expires 7d;
}
}
}
# 提醒:要放行需要使用的端口:例如80和443。
https://blog.csdn.net/ljfphp/article/details/78474152
https://blog.csdn.net/u012557538/article/details/77247867