Brief introduction
Nginx often use to deploy our Web site, my server is CentOS7. I do not like to use Nginx download a package and then extract the kind of decompression, I like following this.
installation
- yum package management tools without Nginx, so have to add, run the following code in the server
Sudo rpm Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2. Install Nginx
yum install -y nginx
3. Start Nginx, installing default does not start
systemctl start nginx.service
4. Sometimes restart the server, Nginx does not start to give manual start, so that it can use the following code automatically start at boot
systemctl enable nginx.service
The advance was open 80 ports on the server, not to not visit. Open End visit your public IP, there are things out it is a success.
6.Nginx site storage location
- Custom directory site configuration file
/etc/nginx/conf.d/
- Nginx Global Configuration
/etc/nginx/nginx.conf
- The default site configuration directory
/etc/nginx/conf.d/default.conf
- Default site file directory
/usr/share/nginx/html
7. commonly used commands Nginx
# Restart Nginx
nginx -s reload
# Test Nginx configuration file is correct
nginx -t
# Close Nginx
nginx -s stop
After completion of problems that may arise with (403 and firewall)
- That is the root of the configuration file to point after our directory site. We try to access the domain name and found the following problems arise
which are file permissions, do not have access to your site. I checked my site directory permissions are git: git, normal, and finally found the global configuration file in the directory nginx nginx.conf the
user is equipped with nginx, resulting in no privileges, modified to root
restart nginx (nginx -s reload) can be visited - Firewall might be a little problem, configure the firewall as follows
sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=https sudo firewall-cmd --reload
Other issues
after deployment site server, you can access the public network ip, domain names can not access issues (steady)