Nginx在Linux安装

1、安装相关插件

yum -y install gcc pcre-devel zlib-devel openssl openssl-devel

2、nginx下载地址:https://nginx.org/download/

## 解压
tar -zxvf nginx-1.9.9.tar.gz

##进入nginx目录
cd nginx-1.9.9
## 配置
./configure --prefix=/usr/local/nginx

# make
make
make install

3、验证是否安装成功

# cd到刚才配置的安装目录/usr/loca/nginx/
./sbin/nginx -t

正常情况的信息输出:

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

4、配置开机启动

vim /etc/rc.d/rc.local
#将安装启动路径输入
/usr/local/nginx/sbin/nginx 

5、防火墙开放端口

firewall-cmd --add-port=80/tcp --permanent
#重启防火墙
systemctl restart firewalld

 

posted on 2020-03-24 10:44  JAVA-ROAD  阅读(164)  评论(0)    收藏  举报

导航