安装nginx:
sudo apt-get install nginx
启动nginx;
sudo service nginx start
[alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)2015/01/16 15:55:46 [warn] 1973#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1nginx: the configuration file /etc/nginx/nginx.conf syntax is ok2015/01/16 15:55:46 [emerg] 1973#0: open() "/var/run/nginx.pid" failed (13: Permission denied)nginx: configuration file /etc/nginx/nginx.conf test failed
出现上面的情况要么就是文件没创建,要么就是没权限。所以:
先用touch和mkdir创建文件和文件夹。然后在用sudo chmod a+rwx -R 文件路径赋予所有用户所有权限(777)。
最后在nginx.conf文件中的http下加入
upstream myproject(内网映射的地址别名){ server 192.168.0.27:80(ip:port); } server{ listen 8088; server_name localhost; location / { root html; index index.html index.htm; proxy_pass http://myproject(内网映射地址别名); } }好了,现在使用service nginx start命令启动服务器。然后输入http://localhost:8088看看是不是成功了。
原文地址:http://blog.csdn.net/jackdowson123/article/details/42778413