下面是nginx.conf
server {
listen 00.00.000.000:80;
server_name my_site.com www.my_site.com;
return 301 https://www.my_site.com$request_uri;
}
server {
listen 00.00.000.000:443;
server_name my_site.com www.my_site.com;
error_log /var/log/httpd/domains/my_site.com.error.log error;
ssl on;
ssl_certificate cert/214816718480217.pem;
ssl_certificate_key cert/214816718480217.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://00.00.000.000:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/my_site/web/my_site.com/public_html;
access_log /var/log/httpd/domains/my_site.com.log combined;
access_log /var/log/httpd/domains/my_site.com.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/my_site/web/my_site.com/document_errors/;
}
location @fallback {
proxy_pass http://00.00.000.000:8080;
}
}
在带有 url 的 opencart 中my_site/index.php?route=product/category&path=1_2
没有问题。但是,如果我们使用一些友好的 url,比如my_site/category_1/category_2
页面上的所有 url 都不是以 开头,my_site/image
而是以 开头my_site/category_1/image
,那么就无法加载任何 css、js、图像。
我该如何修复它?