nginx gzip_静态位置/问题
我正在将我的nginx服务器设置为尽可能高效。从登录页开始。我决定使用gzip_静态指令,它工作得很好,将我的14kb index.html预压缩到3kb,当调用site.com/index.html时,它就被提供了 但问题是,当调用site.com/nginx返回403时(我将其设置为始终返回403,以防止扫描器试图找到他们不应该找到的东西,所以这基本上是404) 默认情况下,如何获取location/以提供预压缩index.htmlnginx gzip_静态位置/问题,nginx,nginx-location,Nginx,Nginx Location,我正在将我的nginx服务器设置为尽可能高效。从登录页开始。我决定使用gzip_静态指令,它工作得很好,将我的14kb index.html预压缩到3kb,当调用site.com/index.html时,它就被提供了 但问题是,当调用site.com/nginx返回403时(我将其设置为始终返回403,以防止扫描器试图找到他们不应该找到的东西,所以这基本上是404) 默认情况下,如何获取location/以提供预压缩index.html server { server_name mxga
server {
server_name mxgaming.com;
return 301 $scheme://www.mxgaming.com$request_uri;
}
server {
listen 80;
#listen 443 ssl;
server_name www.mxgaming.com;
root C:\\WebServer\\nginx\\www\\www.mxgaming.com;
index index.html index.htm index.php;
charset utf-8;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log C:\\WebServer\\nginx\\logs\\www.mxgaming.com-error.log error;
sendfile off;
client_max_body_size 100m;
gzip_static on;
gzip off;
gzip_min_length 1024;
gzip_proxied any;
gzip_http_version 1.1;
gzip_comp_level 4;
gzip_vary on;
gzip_types text/xml text/javascript application/atom+xml application/javascript application/json application/rss+xml application/xml+rss application/vnd.ms-fontobject application/x-font-ttf application/x-web-app- manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component;
server_tokens off;
location / {
try_files $uri $uri/ /index.html;
}
location ~* /teamspeak/? {
try_files $uri $uri/ /teamspeak.html;
}
location /teamspeakfull(?:/|) {
try_files $uri $uri/ /teamspeakfull.html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9123;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_intercept_errors off;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 60;
fastcgi_read_timeout 60;
}
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|woff|ogv|webm|htc)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
location ~* \.(css|js)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
try_files $uri $uri/ /assets/$1/$uri;
}
location ~ /\.ht {
deny all;
}
}
同样,只要您直接调用and.html、.js.css,调用它们就可以工作,但只是/不可以。对于超限的事情,您可以临时返回不同的代码吗?可能有助于缩小范围。比如410消失或者501没有实现。如果我们能看到更多的配置,也可能会有所帮助。好的,我添加了完整的配置,主要是因为我做了一些更改。错误日志中有什么内容吗?你能暂时为超出限制的内容返回不同的代码吗?可能有助于缩小范围。比如410消失或者501没有实现。如果我们能看到更多的配置,也可能会有所帮助。好的,我添加了完整的配置,主要是因为我做了一些更改。错误日志中有什么内容吗?