[英]How to set up nodejs + nginx on windows 8
我在本教程后面的Windows 8上使用nodejs + nginx,並使用此鏈接進行設置,我在端口“ http://127.0.0.1:3000/ ”和端口“ 3000”處獲得“ Hello World ”,但在“ http: //robstodo.com/ “在啟動啟動Nginx服務器的命令編寫時不起作用:- 啟動Nginx僅黑屏閃爍,我如何知道我的應用程序正在Nginx服務器上運行? 以及我應該更改哪個文件。 它是我的server.js
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\\n'); }).listen(3000, '127.0.0.1'); console.log('Server running at http://127.0.0.1:3000/');
這是我的nginx.conf
http { //server_names_hash_bucket_size 64; //... upstream app_robstodo { server 127.0.0.1:3000; } server { listen 80; server_name www.robstodo.com robstodo.com; access_log /path/to/logs/nginx/minitorials.log; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://app_robstodo/; proxy_redirect off; } } }
請幫助我,我現在被卡住了。
為了對您的域進行臨時測試,應在Windows 8中使用hosts
文件。
C:\Windows\System32\drivers\etc
在主機文件中添加:
127.0.0.1 robstodo.com
然后保存,並再次訪問http://robstodo.com/ 。
對於將您的域指向Web服務器(在這種情況下,Windows 8是Web服務器)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.