1、下载nginx
下载 nginx-1.9.9.tar.gz
2、解压
tar -zxvf nginx-1.9.9.tar.gz
3、安装依赖
yum -y install gcc pcre-devel zlib-devel openssl openssl-devel
4、进入nginx目录
cd nginx-1.9.9
5、配置安装文件
./configure --prefix=/usr/local/nginx --with-http_ssl_module
注意:代表安装到/usr/local/nginx目录下,开启https
6、安装nginx
make
make install
7、检查安装成功
cd /usr/local/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
8、启动nginx
cd /usr/local/nginx/sbin
./nginx
9、开启80端口
firewall-cmd --add-port=80/tcp --permanent
# 重启防火墙
systemctl restart firewalld
10、nginx开机启动
vim /etc/rc.d/rc.local
末尾增加:
/usr/local/nginx/sbin/nginx
网友评论