Linux下安装Nginx及配置
Nginx详细的安装教程
https://blog.****.net/u013641234/article/details/73838472
root环境下安装
1.准备资源,下载nginx及相关组件:
(1)、cd usr/local/src 进入下载目录,可自定义
(2)、准备下载4个程序:
wget http://nginx.org/download/nginx-1.10.2.tar.gz
wget http://www.openssl.org/source/openssl-fips-2.0.10.tar.gz
wget http://zlib.net/zlib-1.2.11.tar.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
安装:yum install gcc-c++ (点击y即可)安装结尾显示complete,即代表安装完成
2.安装nginx及其组件
(1)、安装openssl:
tar -zxvf openssl-fips-2.0.10.tar.gz
cd openssl-fips-2.0.10
./config && make && make install 进入文件执行安装程序
(2)、安装pcre
tar -zxvf pcre-8.40.tar.gz
cd pcre-8.40
./configure && make && make install
(3)、安装zlib
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure && make && make install
(4)、安装nginx
tar zxvf nginx-1.10.2.tar.gz
cd nginx-1.10.2
./configure && make && make install
3.启动nginx
(1)、查看nginx安装的地址(whereis)
(2)、进入目录启动: cd /usr/local/nginx/
执行命令:./nginx
4.测试安装是否成功:
进入浏览器,键入localhost,会跳出welcome to nginx!(切忌关闭防火墙)
启动:./nginx
重启:./nginx -s reload
nginx配置本地端口转发(监听80,转发8080)
https://blog.****.net/Brady74/article/details/81071989
proxy_pass http://127.0.0.1:8080;