如何给nodejs开发的web 绑定域名
2016-07-03 20:42
483 查看
如下是我博客和在线工具的nginx配置文件(nginx.conf),大家可以参考下,虽然写的有点简单,但是还是好使的。
博客 (http://www.9958.pw) 用的nodejs,端口3000,在线工具 (http://tool.9958.pw) 用的是apache+php+mysql,端口8080,2个应用都是通过nginx前端代理转发请求到对应端口服务上的。
转载自:http://www.9958.pw/post/nodejs_domain
博客 (http://www.9958.pw) 用的nodejs,端口3000,在线工具 (http://tool.9958.pw) 用的是apache+php+mysql,端口8080,2个应用都是通过nginx前端代理转发请求到对应端口服务上的。
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include 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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; upstream nginx.9958.com { server localhost:3000; } server { #nginx的监听端口 listen 80; #这里是请求域名 server_name 9958.pw www.9958.pw; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://nginx.9958.com; #请求转发到哪里 # root html; # index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } server { listen 80; server_name tool.9958.pw; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://tool.9958.pw:8080; # root html; # index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } ##############################################################################en d weixin.9958.pw################################### # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443; # server_name localhost; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
转载自:http://www.9958.pw/post/nodejs_domain
相关文章推荐
- NodeJS基础1——基础介绍
- LeetCode - 92. Reverse Linked List II
- nodejs模块机制
- BUG-getContainingNode(): node module not found
- js获取子节点childNodes和children的区别
- Node.js-安装配置【1】-在Windows XP系统配置环境变量
- 使用node.js的Crypto模块Hmac算法对信息进行认证
- WebStorm NodeJS
- node版本管理 n和nvm说明
- Node.js学习心得
- NodeJS学习历程(3)
- [leetcode]19. Remove Nth Node From End of List
- Nth to Last Node in List
- Remove Nth Node From End of List
- NodeJS学习历程(2)
- 阿里云服务器搭建ghost博客之Node环境安装(一)
- 提高node性能的奇怪办法
- node.js后台jquery前台-- 实现用户登录注册AJAX交互
- nodejs的module.exports 与 exports
- nodejs学习一