The main content of this article is about the quick installation of nginx pagoda under centos system. Interested friends can learn about it and hope it will be helpful to you.
1. Preparation
The installation of Nginx depends on the following three packages, which means that you must first install the three packages before installing Nginx. Note that the installation order is as follows:
1 The SSL function requires the openssl library, which can be installed directly through yum: #yum install openssl
2 The gzip module requires the zlib library, which must be installed directly through yum: #yum install zlib
3 The rewrite module requires pcre library, install directly through yum: #yum install pcre
This is seen in this blog post http://www.cnblogs.com/hanyinglong/p/5102141.html. These three are not I don’t know if it was installed directly during the system installation.
Anyway, I reinstalled it again.
2. Install Nginx dependencies and Nginx
1. Use yum to install nginx. You need to include Nginx library, install Nginx library
#rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx. noarch.rpm
2 Use the following command to install nginx
#yum install nginx
3 Start Nginx
#service nginx start
This is what I saw in this blog post http://www.cnblogs.com/Robert-huge/p/6003934.html. I found it after installing Nginx directly and reported an error. There was no error after using this blogger's method to install it.
3. Configure nginx to start up
If it is a new nginx, there is an nginx.service file in the /lib/systemd/system/ directory, and you need
systemctl enable nginx Just add the startup command to .service. Otherwise, create a new file in this directory and write
[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
After saving, add it to the system command.
4. Install php-fpm
Unlike apache, nginx must be configured with php-fpm (fpm = fastcgi process manager) to improve PHP parsing performance and reduce memory consumption.
Related tutorials: nginx video tutorial
The above is the detailed content of Quick installation of nginx pagoda under centos system. For more information, please follow other related articles on the PHP Chinese website!