搭建Nginx代理服务及配置

部署一个能将收敛web的IP服务,通过一个IP一个端口,可以访问到其它所有的web服务。而Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行。在互联网等公司被广泛使用,下面简单讲解一下如何搭建Nginx代理服务并配置。

一.下载Nginx

        打开Nginx下载地址:http://nginx.org/en/download.html,下载Nginx。

二.安装Nginx

cd /home/bijian/

mkdir nginx

cd /home/bijian/nginx

rz-bye   [将下载下来的nginx-1.10.1.tar.gz上传到当前目录]

tar-zxvf nginx-1.10.1.tar.gz

cd /home/bijian/nginx/nginx-1.10.1

./configure --prefix=/home/bijian/nginx/nginx

make;make install

 

三.配置nginx

配置nginx.conf文件

cd /home/bijian/nginx/nginx

vim nginx.conf

1.修改nginx绑定的端口

2.增加RS或验证服务是否搭建OK

        从上面我们可看到,nginx的/服务将返回index。于是输入curl 'http://localhost:38082/';命令回车,显示如下内容:

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

说明http协议的配置OK。

posted on 2016-08-19 22:08  bijian1013  阅读(417)  评论(0)    收藏  举报

导航