美文网首页
内部有apache httpd服务的网站,如果换成nginx?

内部有apache httpd服务的网站,如果换成nginx?

作者: 黑色汪汪汪 | 来源:发表于2018-09-21 15:24 被阅读0次

维护一个公司的网站,本来该公司有台服务器,跑的是官网,用的语言是php,web服务器用的是httpd。

现在的需求是,上架我们的服务器,java写的,用的tomcat,用httpd做代理,时而能访问,时而访问不了!
一气之下,决定安装nginx。如果把他的php网站迁移到nginx下,那就麻烦了,不知道他们都有了什么配置,是否有rewrite,不敢动。

于是乎,用nginx代理httpd访问吧。

代码区区几行,希望能帮到遇到同样问题的人。
1:先把httpd的端口改成不是80端口的,我这里该成8000.
2:配置nginx,价格虚拟主机 server,在server {}里面,编辑location/如下:

server {
        listen       80;
        server_name  acb.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            proxy_pass   http://127.0.0.1:8000/ ;
            proxy_redirect default;
            #root   html;
            #index  index.html index.htm;
        }
}

重启nginx,看看是否可以访问acb.com了。

相关文章

网友评论

      本文标题:内部有apache httpd服务的网站,如果换成nginx?

      本文链接:https://www.haomeiwen.com/subject/ahaanftx.html