随笔 - 103,  文章 - 0,  评论 - 1,  阅读 - 16万

Nginx的下载网址为:http://nginx.org/en/download.html

 

Nginx源码下载

# mkdir /root/nginx

# cd /root/nginx

# wget http://nginx.org/download/nginx-1.12.2.tar.gz

# tar zxvf nginx-1.12.2.tar.gz

安装依赖软件

# yum -y install gcc gcc-c++ autoconf automake make zlib zlib-devel openssl openssl-devel pcre pcre-devel

gccgcc-c++:标准GCC编译器;

pcrepcre-devel:支持rewrite模块;

zlib zlib -devel:支持gzip模块;

opensslopenssl-devel:支持ssl模块。

 

安装Nginx

指定安装路径./configure --prefix=/usr/local/nginx指定安装路径为/usr/local/nginx

# cd nginx-1.12.2

# ./configure --prefix=/usr/local/nginx  

编译

# make

安装

# make install

启动Nginx

# cd /usr/local/nginx/sbin

# ./nginx

默认的端口为80端口,我安装Nginx的主机IP172.21.13.165,浏览器输入该IP地址,访问

 

 

关于域名转发proxy_pass

有一个需求,访问m.XXX.com的时候,需要实际访问www.YYY.com/m

server {
  listen 80;
  server_name 172.21.13.165;

  #charset koi8-r;

  #access_log logs/host.access.log main;

  location / {
    # root html;
    # index index.html index.htm;
    proxy_pass http://172.21.16.151:8088/logins/;

  }

}

posted on   独醉笑清风  阅读(263)  评论(0编辑  收藏  举报
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示