nginx本地访问配置

server {
listen 80;
server_name old.dmgcf.com;
rewrite ^(.*) https://old.dmgcf.com$1 permanent;
#location /nginx_status{
#stub_status on;
#access_log off;
#allow 127.0.0.1;
#allow 106.120.182.134;
#deny all;
#}
}
server {
listen 443;
server_name old.dmgcf.com;
access_log logs/com.access.log main;
error_log logs/com.error.log;
ssl on;
ssl_certificate /usr/local/nginx/conf/ssl/2019/server.cer;
ssl_certificate_key /usr/local/nginx/conf/ssl/2019/server.key;
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:1m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
#location ~ /site/SendCode {
# if ($http_referer ~ "https://old.dmgcf.com/site/SendCode") {
# return 403;
# }
# proxy_pass http://.dmgcf.com:81;
#}

location / {
root /data/web/redman;
index index.html index.htm index.php;
if (!-e $request_filename){
rewrite ^/(.*) /index.php last;
}
}
location ~ .php$ {
root /data/web/redman;
fastcgi_pass 172.17.10.153:9000;
fastcgi_index index.php;
fastcgi_connect_timeout 60;
fastcgi_read_timeout 600;
fastcgi_send_timeout 600;
# # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

}
server {
listen 81;
server_name www.dmgcf.com;
access_log logs/access.log ;
error_log logs/error.log;
location / {
root /data/web/redman;
index index.html index.htm index.php;
if (!-e $request_filename){
rewrite ^/(.*) /index.php last;
}
if ($http_user_agent ~* "GTXs+LOL")
{
return 404;
}
}
location ~ .php$ {
root /data/web/redman;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass 172.17.10.153:9000;
#fastcgi_pass webpc;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

原文地址:https://www.cnblogs.com/fangdecheng/p/10634703.html