我写了一个关于Apacheconfiguration的类似问题 ,但我也对nginx感兴趣。 除nginxconfiguration中指定的用户代理之外,是否可以要求基本authentication?
这个集团 location ~ \.php$ { deny all; } 它能够很好地阻止所有以.php结尾的文件,而且也可以在任何地方使用 但是当这个被添加到上面的块之后(它提供静态文件) location ^~ /cdn/ { try_files $uri =404; expires 365d; } cdn / test.php(存在)将被下载,而cdn / test1.php(不存在)给404。 我尝试添加rest; 或嵌套的位置在CDN,但它并没有帮助阻止。
正如您在安装nginx时所了解的那样,它带有名为www默认池和名为default的默认站点。 我怎样才能安全地删除这两个? 因为我已经创build了一个新的池和站点,我想通过删除这些来释放一些资源。
我有一个网站groupsitedev.com。 它不会强制网站httpd总是。 我已经完成了下面的设置,但仍然从http加载一些链接。 这里是configuration: server { listen *:80 default_server; if ($scheme = http) { return 301 https://$host$request_uri; } } 我试图只使用返回301,如果没有,这里是我得到错误的截图 https://www.dropbox.com/s/mqqdbmwl4vf43qp/error.JPG?dl=0 但仍然不会强制所有链接转移到https。
我有麻烦让我的index.php页面打开。 相反,我把它作为一个随机命名的下载链接。 我的configuration非常接近默认。 服务器{ listen 80; root /path/to/html/docs; index index.php; location / { autoindex on; try_files $uri $uri/ /index.php; } } 我曾尝试closuresnginx.conf中的sendfile,并将文本/ php添加到应用程序的gzip列表中,但无济于事。
我一定在这里错过了一些非常愚蠢的东西,但我看不见它。 我有以下url格式: https://www.example.com/french/xx/cats_59_H_L.html …和这个规则: rewrite ^/french/.*/cats_([0-9]+)_([AZ])_([AZ])\.html$ /cgi-bin/hotels/related_cats.cgi?ID=$1&start=$2&end=$3&type=chambres&t=french last; 但是,它给出了一个404: 2017/08/30 12:52:59 [error] 8041#8041: *1147655 open() "/home/user/web/example.com/public_html/french/xx/cats_59_H_L.html" failed (2: No such file or directory), client: 81.174.134.133, server: example.com, request: "GET /french/xx/cats_59_H_L.html HTTP/2.0", host: "www.example.com" 更新:好的,以及我已经find了违规的规则,但我正在努力解决如何解决它。 location /french { include /home/fatpeter/conf/web/chambres.com.extra/other-cats-french.conf; } 我的域的主要configuration是: server { listen 111.74.193.98:443 http2; listen [::]:443 http2; server_name example.com www.example.com; root /home/user/web/example.com/public_html; index […]
我试图在redhat中使用Ubuntu的框架,但它总是有这个错误: 有人能告诉我一个解决scheme吗? 在/ etc / nginx / sites-enabled / default中not allowed “ worker_processes ”指令:3 #user nginx; #worker_processes auto; #error_log /var/log/nginx/error.log; #pid /run/nginx.pid; events { worker_connections 1024; } http { log_format main '$remote_addr – $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size […]
我在nginx.conf中需要一些帮助。 我需要从使用客户端证书身份validation的设备开始保护资源。 其他资源通过https,但不需要客户端证书。 我使用库在Ubuntu 16.04上安装了nginx。 然后我在/etc/nginx/conf.d/中创build一个名为dozee.conf的文件,并从服务器默认的Q&A( https://serverfault.com/a/721704/80340 )粘贴内容,并根据需要进行修改。 dozee.conf里面的configuration看起来像 server { listen *:443 ssl; server_name localhost; ssl on; ssl_certificate /etc/nginx/server.crt; ssl_certificate_key /etc/nginx/server.key; ssl_client_certificate /etc/nginx/ca.crt; ssl_verify_client on; location /device { proxy_pass http://localhost:8080/device; proxy_read_timeout 90; #proxy_redirect http://localhost/ $scheme://$host:$server_port/; } } server { listen *:443 ssl; ssl on; ssl_certificate /etc/nginx/server.crt; ssl_certificate_key /etc/nginx/server.key; ssl_client_certificate /etc/nginx/ca.crt; ssl_verify_client off; location / […]
当我在Ubuntu环境下开发时,我得到了一个警告,说服务器很快就会被淘汰。 所以我跟踪了哪个文件在磁盘上占用了太多的空间。 而且我能够发现在etc/nginx下面有一个文件名。 (我正在使用nginx) 这个文件是做什么的? 这个文件占用了7.7G,其types是ASCII文本,很长的行(我通过使用file *命令) 我想通过删除这个文件来pipe理服务器的存储。 这样做是否安全? 我不能只是不断增加服务器的存储空间。 如果有什么看起来可疑和错误的,任何build议和意见,将不胜感激。 先谢谢你。 这里是nginx.conf user www-data; worker_processes auto; error_log /var/log/nginx/error.log crit; pid /var/run/nginx.pid; events { worker_connections 4000; use epoll; multi_accept on; } http { # cache informations about FDs, frequently accessed files # can boost performance, but you need to test those values open_file_cache max=200000 inactive=20s; […]
我最近改变了我的nginxconfigurationredirect所有httpstream量到https(和所有wwwstream量到no-www)。 add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;添加add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;是否有意义add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; 我的服务器块以及? 或者这是不必要的,因为我已经redirect所有stream量? 知道优点(和缺点,如果有的话)将是伟大的。 在相关的情况下,我目前的虚拟主机configuration是: server { server_name example.com www.example.com; listen 80; return 301 https://example.com$request_uri; } server { server_name www.example.com; listen 443 ssl; ssl_certificate /etc/nginx/ssl/cert_chain.crt; … other SSL related config … return 301 https://example.com$request_uri; } server { server_name example.com; listen 443 ssl; […]