第一步:进入目录/etc/nginx/conf.d
修改virtual.conf的内容为:
server {
listen 8080;
listen localhost:8080;
server_name localhost;
location / {
root /usr/share/nginx/html/example;
index index.html index.htm;
}
} 请把example改为你的程序根目录!
第二步:重启nginx /etc/init.d/nginx restart
即可从8080端口访问站点。(比如你的服务器ip为43.14.156.134, 那么可以用43.14.156.134:8080访问刚刚配置好的这个站点)