You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
3.1 KiB
116 lines
3.1 KiB
3 years ago
|
server {
|
||
|
listen 80;
|
||
|
server_name localhost;
|
||
|
# 全站使用https则开启下面这个注释
|
||
|
# rewrite ^ https://$http_host$request_uri? permanent;
|
||
|
|
||
|
#charset koi8-r;
|
||
|
|
||
|
#access_log logs/host.access.log main;
|
||
|
root /usr/share/nginx/html;
|
||
|
location / {
|
||
|
|
||
|
index index.html index.htm index.php;
|
||
|
}
|
||
|
|
||
|
#error_page 404 /404.html;
|
||
|
|
||
|
# redirect server error pages to the static page /50x.html
|
||
|
#
|
||
|
error_page 500 502 503 504 /50x.html;
|
||
|
location = /50x.html {
|
||
|
root html;
|
||
|
}
|
||
|
|
||
|
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
||
|
#
|
||
|
#location ~ \.php$ {
|
||
|
# proxy_pass http://127.0.0.1;
|
||
|
#}
|
||
|
|
||
|
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||
|
#
|
||
|
location ~ \.php$ {
|
||
|
root /var/www/html;
|
||
|
fastcgi_pass php:9000;
|
||
|
fastcgi_index index.php;
|
||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||
|
include fastcgi_params;
|
||
|
}
|
||
|
|
||
|
# deny access to .htaccess files, if Apache's document root
|
||
|
# concurs with nginx's one
|
||
|
#
|
||
|
#location ~ /\.ht {
|
||
|
# deny all;
|
||
|
#}
|
||
|
}
|
||
|
|
||
|
server {
|
||
|
listen 443 ssl;
|
||
|
server_name localhost;
|
||
|
#valid_referers none blocked server_names
|
||
|
# https://segmentfault.com;
|
||
|
#if ($invalid_referer) {
|
||
|
# return 403;
|
||
|
#}
|
||
|
|
||
|
#禁止使用ip直接访问
|
||
|
#if ( $host ~* "\d+\.\d+\.\d+\.\d+" ) {
|
||
|
# return 501;
|
||
|
# }
|
||
|
|
||
|
# ssl_certificate /etc/nginx/cert/*.pem;
|
||
|
# ssl_certificate_key /etc/nginx/cert/*.key;
|
||
|
|
||
|
ssl_session_cache shared:SSL:1m;
|
||
|
ssl_session_timeout 5m;
|
||
|
|
||
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||
|
ssl_prefer_server_ciphers on;
|
||
|
|
||
|
root /usr/share/nginx/html;
|
||
|
|
||
|
#location ~* ^.+\.(ico|gif|jpg|jpeg|png)$ {
|
||
|
# access_log off;
|
||
|
# expires 30d;
|
||
|
#}
|
||
|
#location ~* ^.+\.(css|js|txt|xml|swf|wav)$ {
|
||
|
# access_log off;
|
||
|
# expires 24h;
|
||
|
#}
|
||
|
#location ~* ^.+\.(html|htm)$ {
|
||
|
# expires 1h;
|
||
|
#}
|
||
|
|
||
|
#location ~* ^.+\.(eot|ttf|otf|woff|svg)$ {
|
||
|
# access_log off;
|
||
|
# expires max;
|
||
|
#}
|
||
|
|
||
|
location / {
|
||
|
#valid_referers https://segmentfault.com;
|
||
|
#if ($invalid_referer) {
|
||
|
# return 502;
|
||
|
#}
|
||
|
#try_files $uri $uri/ /index.php?$query_string;
|
||
|
|
||
|
index index.html index.htm index.php;
|
||
|
if (!-e $request_filename) {
|
||
|
rewrite ^(.*)$ /index.php?s=/$1 last;
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
location ~ \.php$ {
|
||
|
root /var/www/html;
|
||
|
fastcgi_pass php:9000;
|
||
|
fastcgi_index index.php;
|
||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||
|
include fastcgi_params;
|
||
|
}
|
||
|
|
||
|
}
|