linux下安装配置nginx-Geyh的博客
这里以nginx-1.13.12版本为例子1、首先去官网下载nginx-1.13.12.tar.gz安装包并上传到linux服务器并解压缩安装包
tar -zxvf nginx-1.13.12.tar.gz
2、在安装ngxin之前我们首先要保证linux的防火墙是关闭状态
systemctl stop firewalld.service #停止
firewall systemctl disable firewalld.service#禁止firewall开机启动�
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
3、安装c++编译环境,如果已经安装过忽略即可
yum install gcc-c++
Is this ok : y
安装成功
测试
# gcc
gcc: 致命错误:没有输入文件
编译中断。
# make
make: * 没有指明目标并且找不到 makefile。 停止。
4、安装一下nginx的一些相关依赖
yum install-y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
5、安装完依赖之后进入nginx解压后的文件夹
执行命令./configure --prefix=/home/demo/nginx
/home/demo/nginx这个路径是指定ngxin的安装目录
6、安装完成之后执行ls命令会发现解压缩文件夹下有会多出来一个Makefile文件
7、开始安装
命令:make
命令:make install
8、查看安装目录
# cd /home/demo/nginx
# ls
confhtmllogssbin
9、启动nginx
# cd sbin/
# ls
nginx
# ./nginx
查看进程
# ps aux|grep nginx
root 77790.00.020544 612 ? Ss 05:27 0:00 nginx: master process ./nginx
nobody 77800.00.1230761636 ? S 05:27 0:00 nginx: worker process
root 78840.00.0 112720 984 pts/2 S+ 05:29 0:00 grep --color=auto nginx
访问服务器测试
10、关闭nginx
# ./nginx -s stop
# ps aux|grep nginx
root 79510.00.0 112720 984 pts/2 S+ 05:33 0:00 grep --color=auto nginx
11、重新加载配置文件
./nginx -s>
页:
[1]