centos nginx和tomcat 通过反向代理生成想要的nexus网址

研究背景:

最近一直在研究maven nexus 私服,所以想在自己带老笔记本上搭建一个私服,看到网上很多私服都有自己带域名,所以想在搭建过程中通过修改host 生成想要带域名

成功截图:

 

操作步骤:

1)到nginx官网下载nginx

2)安装nginx

安装步骤可以参考http://www.cnblogs.com/zhoulf/archive/2013/02/09/2909653.html

[root@admin nginx]# ./configure --prefix=/usr/local/nginx

遇到的问题: 本想修改配置的路径,修改了遇到nginx编译不成功的错误,后来默认用/usr/local/nginx问题解决

3)安装成功后访问127.0.0.1到nginx的欢迎页面

4)修改nginx配置文件

vi /usr/local/nginx/conf/nginx.conf

  

5)添加server配置如下图

注意:因为在二级域名的设置中,刚开始没有加proxy_pass 最后的/导致老时访问不到:

参考文章:http://wangwei007.blog.51cto.com/68019/1103734

6)测试修改的配置文件是否正确: 

[root@rose4j nginx]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

7)重新使nginx配置生效

[root@rose4j nginx]# ps aux|grep nginx
root 4217 0.0 0.0 3740 1276 ? Ss Sep13 0:00 nginx: master process ./sbin/nginx
nobody 4595 0.0 0.0 3876 1328 ? S 00:16 0:00 nginx: worker process
root 4734 0.0 0.0 4356 736 pts/1 S+ 00:46 0:00 grep nginx
[root@rose4j nginx]#
[root@rose4j nginx]# kill -hup 4217
[root@rose4j nginx]# /usr/local/nginx/sbin/nginx -s reload

 

另外Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,Nginx,它的发音为“engine X”, 是一个高性能的HTTP和反向代理服务器,同时也是一个IMAP/POP3/SMTP 代理服务器.Nginx是由俄罗斯人 Igor Sysoev为俄罗斯访问量第二的 Rambler.ru站点开发的,它已经在该站点运行超过两年半了。Igor Sysoev在建立的项目时,使用基于BSD许可。

其强大的功能还体现在负载均衡,缓存,URL rewite等实际操作和应用中,因为资源有限暂不做研究,参考文章如下:

http://freeloda.blog.51cto.com/2033581/1288553

posted @ 2014-09-14 00:53  骚客的风  阅读(1620)  评论(0编辑  收藏  举报