Php NGINX try_文件重写会在出现斜杠时导致css样式消失

Php NGINX try_文件重写会在出现斜杠时导致css样式消失,php,css,nginx,Php,Css,Nginx,因此,我试图创建一种机制,使用NGINX/PHP-FPM使用下面的基本配置来处理友好的URL 当我使用不存在的uri运行地址时,如: 默认页面中的所有样式都消失了。我本以为自己对所发生的事情有一种感觉,并进行了详尽的搜索,但堆栈上、日志中或Firebug或Chrome中没有任何东西可以证实我的直觉 以下是我的nginx配置: 服务器 listen 192.168.1.80:80 default_server; listen 192.168.1.80:443 default_server ssl

因此,我试图创建一种机制,使用NGINX/PHP-FPM使用下面的基本配置来处理友好的URL

当我使用不存在的uri运行地址时,如:

默认页面中的所有样式都消失了。我本以为自己对所发生的事情有一种感觉,并进行了详尽的搜索,但堆栈上、日志中或Firebug或Chrome中没有任何东西可以证实我的直觉

以下是我的nginx配置:

服务器

listen 192.168.1.80:80 default_server;
listen 192.168.1.80:443 default_server ssl;

root /home/main/jb/www/;        
client_max_body_size 30M;

# access_log  logs/host.access.log  main;

location / {
    # try_files $uri $uri/ /index.php;
    try_files $uri $uri/ /index.php?$uri&$args;
    index index.php;
    include mime.types;
}

error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   html;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
     root   /home/main/jb/www/;
     try_files $uri =404;
     fastcgi_split_path_info ^(.+\.php)(.*)$;
     fastcgi_pass   127.0.0.1:9000;
     fastcgi_index  index.php;
     fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

     include fastcgi_params;

     fastcgi_ignore_client_abort on;
     fastcgi_param  SERVER_NAME $http_host;             
     fastcgi_connect_timeout 60;
     fastcgi_send_timeout 180;
     fastcgi_read_timeout 180;
     fastcgi_buffer_size 128k;
     fastcgi_buffers 4 256k;
     fastcgi_busy_buffers_size 256k;
     fastcgi_temp_file_write_size 256k;
     fastcgi_intercept_errors on;
}
location ~ /\.ht {
        deny  all;
}
免责声明:这是从问题中摘录的


我似乎已经解决了这个问题,在所有的脚本和链接选项卡中添加了一个完整的url,而以前我只是使用相对路径。我不确定我是否完全理解解决方案的动态性,但我希望这会有所帮助。

很高兴您解决了自己的问题。我已经把你的答案移到了答案部分,以免妨碍你回答这个问题。