Nginx在CentOS上的安装
--------------------------先下载Nginx需要的依赖----------------------------------------------
yum install gcc-c++
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
yum install -y openssl openssl-develmkdir /opt/nginx-source
mkdir /opt/nginx
-------------------------在/opt/nginx-source中下载源码-------------------------------------
cd /opt/nginx-source
wget http://nginx.org/download/nginx-1.13.11.tar.gz
tar zxvf nginx-1.13.11.tar.gz-------------------------解析Nginx源码包,输出到/opt/nginx目录下-----------------------------------
cd /opt/nginx-source/nginx-1.13.11
./configure --prefix=/opt/nginx
make
make install
./nginx -s stop #立即停止
./nginx -s quit #安全停止
./nginx -s reload #重启
./nginx # 启动
下面的配置是用80端口代理本机的8080端口
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://localhost:8080;
proxy_redirect default;
}
#charset koi8-r;
#access_log logs/host.access.log main;
#location / {
# root html;
# index index.html index.htm;
#}
}