2017-05-10 49 views
1

我學習的節點。我使用了Ubuntu服務器,安裝了nodejs,並嘗試使用一些指南來設置nginx。所有看起來不錯,但...服務器返回我我的app.js代碼,而不是索引頁。我做錯了什麼?謝謝!帶節點的Nginx服務器返回js代碼

hack-it-up.ru.conf :

server { 
    listen 80 default_server; 
    listen [::]:80 default_server ipv6only=on; 
    server_name hack-it-up.ru www.hack-it-up.ru; 

    include /etc/nginx/snippets/letsencrypt.conf; 

    location/{ 
     return 301 https://www.hack-it-up.ru$request_uri; 
    } 

} 


server { 
    server_name www.hack-it-up.ru; 
    listen 443 ssl http2 default_server; 
    listen [::]:443 ssl http2 default_server ipv6only=on; 

    ssl_certificate /etc/letsencrypt/live/www.hack-it-up.ru/fullchain.pem; 
    ssl_certificate_key /etc/letsencrypt/live/www.hack-it-up.ru/privkey.pem; 
    ssl_trusted_certificate /etc/letsencrypt/live/www.hack-it-up.ru/fullchain.pem; 
    include /etc/nginx/snippets/ssl.conf; 

    root /var/www/hack-it-up.ru; 
    index app.js; 
    location/{ 
     try_files $uri $uri/ =404; 
    } 
} 


server { 
    listen 443 ssl http2; 
    listen [::]:443 ssl http2; 
    server_name hack-it-up.ru; 

    ssl_certificate /etc/letsencrypt/live/www.hack-it-up.ru/fullchain.pem; 
    ssl_certificate_key /etc/letsencrypt/live/www.hack-it-up.ru/privkey.pem; 
    ssl_trusted_certificate /etc/letsencrypt/live/www.hack-it-up.ru/fullchain.pem; 
    include /etc/nginx/snippets/ssl.conf; 

    location/{ 
     return 301 https://www.hack-it-up.ru$request_uri; 
    } 
} 
+0

您應該監聽節點應用程序中的某個端口號,並將您的請求從nginx轉發到此端口 – Ezzat

回答

0

因爲我maked錯誤索引文件我得到這個錯誤。它必須是index /bin/www