2016-07-20 17 views
0

NGINXが設定されているVPS用の設定を同僚から継承しました。私は現在httpとhttpsを使って動的コンテンツを提供することができますが、httpsが接続タイプとして指定されている場合、画像、javascript、cssなどの静的コンテンツはロードされません(404として表示)。NGINXのhttps静的コンテンツ

configを継承したので、httpディレクティブの下でngi​​nx.confにロケーションブロックを追加し、使用するルートを指定する際にNGINXの独自のガイドを失敗しましたが、どこから始めたらいいかわかりません。

http{ 
    include  /etc/nginx/mime.types; 
    default_type application/octet-stream; 
    server_tokens off; 
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
    location/{ 
     root /var/www/; 
    } 
} 

私も、しかし、私は、コンテンツを提供することができ、他に何に私の同僚ノートの任意のドキュメントを見つけることができませんよ、無効nginxのと同じ動作を得るのですか。

正しい方向のポインターがあれば幸いです!

このを通じてトロール
user    nginx; 
worker_processes 1; 
error_log   /var/log/nginx/error.log; 
pid    /var/run/nginx.pid; 

events { 
    worker_connections 1024; 
} 



http { 

    include  /etc/nginx/mime.types; 
    default_type application/octet-stream; 
    server_tokens off; 
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 

    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; 
    autoindex off; 
    map $scheme $fastcgi_https { ## Detect when HTTPS is used 
     default off; 
     https on; 
    } 


client_header_timeout 3000; 
client_body_timeout 3000; 
fastcgi_read_timeout 3000; 
client_max_body_size 32m; 
fastcgi_buffers 8 128k; 
fastcgi_buffer_size 128k; 

    keepalive_timeout 10; 

gzip on; 
gzip_http_version 1.1; 
gzip_vary on; 
gzip_comp_level 6; 
gzip_proxied any; 
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js; 
gzip_buffers 16 8k; 
gzip_disable "MSIE [1-6]\.(?!.*SV1)"; 
    # Load config files from the /etc/nginx/conf.d directory 
    include /etc/nginx/conf.d/*.conf; 

} 
+0

'http'の' location'は無効です。あなたのサーバの設定を表示する –

+0

元の投稿にnginx.confを追加しました –

+0

'server'ブロックが表示されません。それらは '/etc/nginx/conf.d/*。conf;'ファイルにあるべきです。 –

答えて

0

nginx.conf

私はnginxのは、X-アクセル内部のサーバー>>場所ブロックにコマンドを追加してきたことがわかりました。 、nginxのは、SSH

を経由して設定ファイルを再作成した後、正常に再びコンテンツを提供しているカスタム/ドメイン/サービスへのconf /テンプレート/デフォルト/ドメイン/サービスからテンプレートproxy.phpをコピーして、このコマンドをコメントアウトすることで

/usr/local/psa/admin/bin/httpdmng --reconfigure-all 
nginx -t && service nginx reload 
関連する問題