nginx不提供css/js图像

nginx不提供css/js图像,css,image,nginx,centos,Css,Image,Nginx,Centos,有时会加载图像,但图标和默认图像图标不显示,im初学者如何解决这个问题让我抓狂,etc/nginx/conf.d中没有配置文件,只有我的服务器中的主nginx配置文件,在这里找到etc/nginx/nginx.config我希望有人能帮助我 我的配置文件 user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; # Load dynamic modules. Se

有时会加载图像,但图标和默认图像图标不显示,im初学者如何解决这个问题让我抓狂,etc/nginx/conf.d中没有配置文件,只有我的服务器中的主nginx配置文件,在这里找到etc/nginx/nginx.config我希望有人能帮助我

我的配置文件

    user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    client_max_body_size 50M;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;


    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
        server {
        server_name xxx.com www.xxx.com;
        listen serverip;
        root /home/xxx/public_html;
        index index.html index.htm index.php;
        access_log /var/log/virtualmin/xxx_access_log;
        error_log /var/log/virtualmin/xxx_error_log;
        fastcgi_param GATEWAY_INTERFACE CGI/1.1;
        fastcgi_param SERVER_SOFTWARE nginx;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_param SCRIPT_FILENAME /home/xxx/public_html$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_param REQUEST_URI $request_uri;
        fastcgi_param DOCUMENT_URI $document_uri;
        fastcgi_param DOCUMENT_ROOT /home/xxx/public_html;
        fastcgi_param SERVER_PROTOCOL $server_protocol;
        fastcgi_param REMOTE_ADDR $remote_addr;
        fastcgi_param REMOTE_PORT $remote_port;
        fastcgi_param SERVER_ADDR $server_addr;
        fastcgi_param SERVER_PORT $server_port;
        fastcgi_param SERVER_NAME $server_name;
        fastcgi_param HTTPS $https;
        location / {
         try_files $uri $uri/ /index.php?$args;
            index index.php index.cgi index.pl index.html index.xhtml index.htm index.shtml;
            fastcgi_index index.php;
            include fastcgi.conf;
            include fastcgi_params;

            fastcgi_pass unix:/var/php-nginx/xxx.sock/socket;

        }
        listen serverip default ssl;
        ssl_certificate /home/xxx/ssl.cert;
        ssl_certificate_key /home/xxx/ssl.key;
    }
}

非常感谢您提供的任何帮助

您有一个将所有请求发送到PHP的
位置
。您没有使用Nginx提供静态文件(如js/css)

通常的PHP配置包含两个
location
块。一个用于处理以
.php
结尾的URI,另一个用于将所有其他内容作为静态文件处理

例如:

location / {
    try_files $uri $uri/ /index.php?$args;
    index index.php index.cgi index.pl index.html index.xhtml index.htm index.shtml;
}
location ~ \.php$ {
    try_files $uri =404;

    include fastcgi.conf;
    include fastcgi_params;

    fastcgi_pass unix:/var/php-nginx/xxx.sock/socket;
}

非常感谢您在我放置location~\.php$时提供的信息{,它说我的网站上没有指定输入文件,你知道吗?
没有指定输入文件
通常意味着脚本文件名设置不正确。我的更改不应该实质性地改变你的工作PHP配置,这就是为什么我没有仔细查看你的包含文件的内容。你建议我怎么做?