CentOS安装Nginx
1. 安装gcc
yum install gcc-c++
2. 安装PCRE-DEVEL
yum install -y pcre pcre-devel
3. 安装zlib
yum install -y pcre pcre-devel
4. 安装OpenSSl
yum install -y openssl openssl-devel
5. 添加Nginx源
rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
6. 安装
yum install -y nginx
7. 添加开机启动,在rc.local添加一行
vi /etc/rc.local
增加一行/usr/sbin/nginx
chmod 755 rc.local
8. 启动
nginx
9. 检查配置文件是否正确
nginx -t
10. 重启nginx
nginx -s reload
11. 查询nginx进程
ps aux|grep nginx
12. 杀掉nginx进程
kill-9 nginx端口
默认路径:
- Nginx配置路径:
/etc/nginx/
- PID目录:
/var/run/nginx.pid
- 错误日志:
/var/log/nginx/error.log
- 访问日志:
/var/log/nginx/access.log
- 默认站点目录:
/usr/share/nginx/html
只需知道Nginx配置路径,其他路径均可在
/etc/nginx/nginx.conf 以及/etc/nginx/conf.d/default.conf