centos7安装nginx

1.首先获取管理员权限下载安装软件包:

yum install gcc-c++

yum install -y pcre pcre-devel

yum install -y zlib zlib-devel

yum install -y openssl openssl-devely

2.利用Xftp吧nginx压缩包上传到/home目录
cd /home
3.解压
tar -zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0/
4.配置
./configure
–prefix=/home/nginx
–pid-path=/var/run/nginx/nginx.pid
–lock-path=/var/lock/nginx.lock
–error-log-path=/var/log/nginx/error.log
–http-log-path=/var/log/nginx/access.log
–with-http_gzip_static_module
–http-client-body-temp-path=/var/temp/nginx/client
–http-proxy-temp-path=/var/temp/nginx/proxy
–http-fastcgi-temp-path=/var/temp/nginx/fastcgi
–http-uwsgi-temp-path=/var/temp/nginx/uwsgi
–http-scgi-temp-path=/var/temp/nginx/scgi
5.将临时文件目录指定为/var/temp/nginx,需要在/var下创建temp及nginx目录
mkdir /var/temp/nginx/client -p
6.查看Nginx解压文件下是否创建了一个makeFile文件
cd /home/nginx-1.8.0/
ll
7.编译
make
make install

8.切换到/home目录下查看是否有nginx目录 有就安装成功
9.永久关闭防火墙
systemctl status firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service
显示disavtive(dead),这样就说明防火墙已经关闭。
9.启动
cd /nginx/sbin
./nginx

在浏览器输入IP地址+端口为80

基本命令
启动
./nginx
关闭
./nginx -s stop
./nginx -s quit
重新加载配置文件
./nginx -s reload

conf 配置目录
html 静态资源目录
sbin 执行目录

你可能感兴趣的:(nginx)