Failed to use this method/q/10...
Not only does the static resource jump to 302, but the 404.html that jumps to cannot be loaded, and the php behind the url cannot be removed. Please help me solve it! ! !
nginx specific configuration is as follows
Port 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 last;
}
}
}
include vhost/*;
Port 443 under vhost/
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;
}
You have too many things configured in port 80. You only need to configure one thing in port 80, that is, all requests jump to 443. Then modify the configuration of 443 specifically.
In 443, you only specified the access to php and did not specify the path to the static resource. The reference configuration is as follows:
If your static resources are placed together with php files, the root in the static resources can be placed outside, like this: