1. Install gcc (it usually comes with centos 7 and later, you can install it after step 6 fails)
yum install gcc gcc-c
2. Install pcre
yum install -y pcre pcre-devel
3. Install zlib
yum install -y zlib zlib-devel
4. Install openssl
yum install -y openssl openssl-devel
5. Download and unzip nginx (then enter the nginx directory)
wget
6. Compile nginx (load common modules such as ssl)
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_ssl_module
7 . Install nginx
make && make install
8. Start
/usr/local/nginx/sbin/nginx
9. Stop
/usr/local/nginx/sbin/nginx -s stop (reload means restart)
10. Use the browser to access the IP address of the machine where nginx is located and verify that nginx is started successfully
http://yourhost/
Note: nginx configuration file location
/usr/local/nginx/conf/nginx.conf
The above is the detailed content of Nginx installation example analysis. For more information, please follow other related articles on the PHP Chinese website!