1.下载nginx

官方网站:

http://nginx.org/download/

2. 要求的安装环境

yum install gcc-c++

yum -y install pcre-devel

yum -y install openssl openssl-devel

yum -y install pcre-devel openssl openssl-devel

3.第一步:把nginx的源码包上传到linux系统

第二步:解压缩

[root@localhost ~]# tar -zxvf nginx-1.8.0.tar.gz

第三步:使用configure命令创建makeFile文件。

./configure --prefix=/opt/nginx --sbin-path=/usr/bin/nginx

注意:启动nginx之前,上边将临时文件目录指定为/usr/local/nainx

第四步:编译nginx :make

第五步:安装nginx:make install

4. 启动nginx

进入sbin目录 启动 nginx

[root@localhost sbin]# ./nginx

 

关闭nginx

[root@localhost sbin]# ./nginx -s stop

推荐使用:

[root@localhost sbin]# ./nginx -s quit

重启nginx

1、先关闭后启动。

2、刷新配置文件:

[root@localhost sbin]# ./nginx -s reload

5. 访问nginx

默认是80端口。

注意:是否关闭防火墙。

1:查看防火状态
systemctl status firewalld
service  iptables status

2:暂时关闭防火墙
systemctl stop firewalld
service  iptables stop

3:永久关闭防火墙
systemctl disable firewalld
chkconfig iptables off

4:重启防火墙
systemctl enable firewalld
service iptables restart  

posted on 2019-05-25 16:30  忆夏KhaZix  阅读(211)  评论(0编辑  收藏  举报