- 工信部备案号 滇ICP备05000110号-1
- 滇公安备案 滇53010302000111
- 增值电信业务经营许可证 B1.B2-20181647、滇B1.B2-20190004
- 云南互联网协会理事单位
- 安全联盟认证网站身份V标记
- 域名注册服务机构许可:滇D3-20230001
- 代理域名注册服务机构:新网数码
server{ listen 80; server_name example.com www.landui.com; return 301 https://www.landui.com$request_uri; } server { listen 443 ssl http2; server_name example.com www.landui.com; root /var/www/html/example.com/; index index.php index.html index.htm; #charset koi8-r; access_log /var/log/nginx/example.com/example.com_access_log; error_log /var/log/nginx/example.com/example.com_error_log error; # SSL/TLS configs ssl on; ssl_certificate /etc/ssl/certs/example_com_cert_chain.crt; ssl_certificate_key /etc/ssl/private/example_com.key; include /etc/nginx/ssl.d/ssl.conf; location / { try_files $uri $uri/ /index.php?$query_string; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www/html/example.com/; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://www.landui.com; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /var/www/html/example.com/; fastcgi_pass 127.0.0.1:9001; #fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; include /etc/nginx/fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }
使用上述配置,一旦客户端尝试通过端口80(即http://www.landui.com访问您的站点,相关错误将显示在下面的屏幕截图中。
Nginx的404错误请求错误
您遇到此错误,因为每当客户端尝试通过HTTP访问您的站点时,请求都被重定向到HTTPS。 这是因为nginx希望在事务中使用SSL,但原始请求t(通过端口80接收)是普通的HTTP,它抱怨错误。
另一方面,如果客户端使用https://www.landui.com ,他们将不会遇到上述错误。 另外,如果你有其他网站配置为不使用SSL,nginx会默认使用HTTPS,导致上述错误。
要解决这个错误,请在您的配置中将下面的行注释掉,或者将其设置为off。
#ssl on
OR
ssl off
保存并关闭文件。 然后重新启动nginx服务。
# systemctl restart nginx
OR
$ sudo systemctl restart nginx
售前咨询
售后咨询
备案咨询
二维码
TOP