2016-12-26 9 views
0

とHTML/CSS/JSファイルを提供することはここに私の静的なWebサイトのディレクトリツリーです:はnginxの

- website 
-- html 
--- index.html 
-- css 
--- styles.css 
-- js 

ここに私のnginxの設定です:

server { 
    listen 80; 

    root /srv/www/domain.com/website/html; 
    index index.php index.html index.htm; 

    server_name domain.com; 

    location/{ 
     try_files $uri $uri/ =404; 
    } 

    location ~ \.php$ { 
     include snippets/fastcgi-php.conf; 
     fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
    } 

    location ~ /\.ht { 
     deny all; 
    } 
} 

それはCSS/JSファイルをロードすることはできませんしかし、それは404を言います見つかりません。どうしましたか?

答えて

2
location ~* \.(js|jpg|png|css)$ { 
     root /srv/www/domain.com/website/; 
     expires 30d; 
    } 

私の問題を解決しました。