首页 > 系统服务 > 详细

ubuntu安装nginx配置反向代理服务器

时间:2015-01-18 00:55:21      阅读:389      评论:0      收藏:0      [点我收藏+]

安装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看看是不是成功了。

ubuntu安装nginx配置反向代理服务器

原文:http://blog.csdn.net/jackdowson123/article/details/42778413

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!