php网站404页面302,使用Nginx搭建Typecho静态资源全部302跳转到404页面

该博客内容涉及一个Nginx配置的疑难问题,博主遇到静态资源302重定向以及404错误页面加载失败的状况。配置中尝试了强制HTTPS和URL重写,但问题依然存在。配置文件包含了80端口和443端口的server块,其中443端口部分涉及SSL证书设置、错误页面重定向和PHP处理。寻求解决方案。
摘要由CSDN通过智能技术生成

不光静态资源302跳转,而且跳转到的404.html还无法加载,还有就是url后面的php去不掉,求大神解决!!!

nginx具体配置如下

80端口

server {

listen 80;

server_name crazyc.cn www.crazyc.cn;

root /var/www/html/;

#rewrite ^/(.*)$ https://crazyc.cn/index.php permanent;

if ($ssl_protocol = "") {

return 301 https://$server_name$request_uri;

}

if ($host != 'crazyc.cn' ) {

return 301 https://crazyc.cn$request_uri;

}

error_log /logs/error.log;

charset utf-8;

client_body_buffer_size 512k;

proxy_connect_timeout 90;

proxy_send_timeout 90;

proxy_read_timeout 4000;

proxy_buffers 32 4k;

client_max_body_size 75m;

# Load configuration files for the default server block.

location / {

index index.html index.php;

if (!-e $request_filename) {

rewrite ^(.*)$ /index.php$1 last;

}

}

}

include vhost/*;

vhost/下的443端口

server {

listen 443 ssl;

server_name crazyc.cn www.crazyc.cn;

ssl on;

ssl_certificate /root/.acme.sh/crazyc.cn/fullchain.cer;

ssl_certificate_key /root/.acme.sh/crazyc.cn/crazyc.cn.key;

ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;

ssl_ciphers HIGH:!ADH:!EXPORT56:RC4+RSA:+MEDIUM;

error_log /logs/error.log;

error_page 404 = https://crazyc.cn/404.html;

charset utf-8;

client_max_body_size 75m;

# Load configuration files for the default server block.

location ~ .*\.php(\/.*)*$ {

root html;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;

include fastcgi_params;

fastcgi_pass 127.0.0.1:9000;

#include fastcgi.conf;

#fastcgi_pass 127.0.0.1:9000;

}

access_log logs/yourdomain.log combined;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值