一、预备工作
Nginx的装置依赖于如下三个包,意义就是正在装置Nginx以前起首必需装置一下的三个包,留意装置程序以下:
1 SSL性能需求openssl库,间接经过yum装置: #yum install openssl
2 gzip模块需求zlib库,间接经过yum装置: #yum install zlib
3 rewrite模块需求pcre库,间接经过yum装置: #yum install pcre
这个是正在这篇博文 http://www.cnblogs.com/hanyinglong/p/5102141.html 外面看到的,这三个没有晓得零碎装置的时分是否是间接装置了
横竖我是又从新装置一遍
二、装置Nginx依赖项以及Nginx
1 应用yum装置nginx需求包罗Nginx的库,装置Nginx的库
#rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2 应用上面饬令装置nginx
#yum install nginx
3 启动Nginx
#service nginx start
这个是正在这篇博文 http://www.cnblogs.com/Robert-huge/p/6003934.html外面看到的,我间接装置Nginx报错后搜到的,用此博主的办法装置后不犯错
三、设置装备摆设nginx开机启动
假如是新的nginx,正在/lib/systemd/system/目次就有nginx.service文件,需求
systemctl enable nginx.service增加启动饬令便可。不然正在此目次下新建此文件,写入
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
[Install]
WantedBy=multi-user.target
保留后,增加到零碎指令.
4.装置php-fpm
跟apache没有同,nginx必需设置装备摆设php-fpm(fpm = fastcgi process manager)进步php解析功能,升高内存耗费。
相干教程:nginx视频教程
以上就是centos零碎下nginx浮图疾速装置的具体内容,更多请存眷资源魔其它相干文章!
标签: php开发教程 php开发资料 php开发自学 Centos nginx
抱歉,评论功能暂时关闭!