nginx学习

1,centos 下nginx平滑升级

yum update nginx

执行命令前,首先配置nginx 源

[root@localhost ~]# vim /etc/yum.repos.d/nginx.repo

#nginx.repo
[nginx] name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1

*baseurl=http://nginx.org/packages/centos/6/$basearch/  这一句需要将里面的6修改成对应centos的版本号,如果是centos5则需要改成5

*根据你使用的操作系统不同,分别使用rhel或者centos替换os,使用5或者6替换osrelease,例如5.x或者6.x版本

*升级过程可能会遇到centos缓存问题;

Not using downloaded repomd.xml because it is older than what we have

Renewed Red Hat and updated the system with yum update, the following error:

 
Not using downloaded repomd.xml because it is older than what we have:
 
解决方案
 
yum clean all && yum check-update
 
清除centos缓存文件就可以了
 
2,启动与重启

启动nginx :nginx -c /etc/nginx/nginx.conf

关闭nginx:./sbin/nginx -s stop

3.nginx 配置

配置php的nginx服务器需要php-fpm支持,使用时请确定php-fpm服务是打开的.

具体请查看

http://ninghao.net/blog/1368

4.查看nginx 进程

ps -ef|grep nginx

5.设置开机启动

chkconfig --add nginx //添加系统服务

chkconfig --level 345 nginx on //设置开机启动,启动级别

chkconfig --list nginx //查看开机启动配置信息 

原文地址:https://www.cnblogs.com/sign-ptk/p/5655455.html