server
{
listen 443 ssl;
server_name www.test.com;
index index.html index.htm index.php;
root /home/wwwroot/xxx/public;
set $basedir "open_basedir=/home/wwwroot/xxx/../:/tmp/:/proc/";
# 这些都是腾讯云推荐的配置,直接拿来用就行了,只是修改证书的路径,注意这些路径是相对于/etc/nginx/nginx.conf文件位置
ssl on;
ssl_certificate /usr/local/nginx/cert/test.net.pem;
ssl_certificate_key /usr/local/nginx/cert/test.net.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
include enable-php.conf;
location ^~ /web/ {
alias /home/wwwroot/xxx/xxx_web/;
try_files $uri $uri/ @web;
autoindex on;
}
location ^~ /static/ {
alias /home/wwwroot/xxx/xxx_web/static/;
try_files $uri $uri/ @static;
autoindex on;
}
location ~ .*\.*app.*(js|css)?$
{
expires 12h;
error_log off;
access_log /dev/null;
if (!-e $request_filename) {
root /home/wwwroot/zgkc/;
break;
}
}
location ~ .*\.*chunk.*(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log off;
access_log /dev/null;
if (!-e $request_filename) {
root /home/wwwroot/zgkc/;
break;
}
}
location / {
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?s=/$1 last;
}
break;
}
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log /home/logs/access.log;
}