我现在有一个node程序跑在1200端口上,但是访问IP+端口号无法访问,直接输入IP是oneinstack的欢迎页,请问怎么访问呢?
另外我想把这个带端口号的地址绑定到namesilo的二级域名上,请问添加什么记录才可以呢?
另外我想把这个带端口号的地址绑定到namesilo的二级域名上,请问添加什么记录才可以呢?
5 Answers
建议使用nginx反向代理node,可vhost.sh绑定,并修改其中www.example.com为你的域名 8080为你node启动端口,修改:/usr/local/nginx/conf/vhost/www.example.com.conf:
server {
listen 80;
server_name www.example.com example.com;
access_log /data/wwwlogs/access_nginx.log combined;
root /data/wwwroot/path_node_source;
index index.html index.htm index.jsp;
#error_page 404 /404.html;
#error_page 502 /502.html;
location ~ {
proxy_pass http://127.0.0.1:8080;
include proxy.conf;
}
location ~ ^/(\.user.ini|\.ht|\.git|\.svn|\.project|LICENSE|README.md) {
deny all;
}
}
server {
server_name www.xxx.com xxx.com;
listen 80;
listen 443;
ssl on;
ssl_certificate /xxx/https/domain.pem;
ssl_certificate_key /xxx/https/domain.key;
root /data/wwwroot/www.sxxx.com;
index index.html index.htm index.php;
#rewrite规则
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}
#node反向代理
location ~ {
proxy_pass http://127.0.0.1:1200;
include proxy.conf;
}
location /nginx_status {
stub_status on;
access_log off;
#allow 127.0.0.1;
# deny all;
}
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip: 9000;
#fastcgi_pass 127.0.0.1: 9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expire