小编Ale*_*hin的帖子

Nginx加载css/images时遇到问题

我已经配置了NGINX,现在它正在处理php和html文件.但它无法加载图像,*.js和*.css文件.这是我的NGINX配置文件.

这是我的nginx.conf文件

    user  nginx;
    worker_processes  1;

    error_log  /var/log/nginx/error.log warn;
    pid        /var/run/nginx.pid;


    events {
        worker_connections  1024;
    }


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

        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;

        keepalive_timeout  65;

        #gzip  on;

        include /etc/nginx/conf.d/*.conf;
     }
Run Code Online (Sandbox Code Playgroud)

这是default.conf文件,可以在/etc/nginx/conf.d中找到

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;
        #access_log  /var/log/nginx/log/host.access.log  main;

        location / {
            root   /home/username/www;
            index  index.php index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages …
Run Code Online (Sandbox Code Playgroud)

configuration nginx

6
推荐指数
0
解决办法
1万
查看次数

标签 统计

configuration ×1

nginx ×1