Configure nginx service, load balancing tomcat

Recently, an nginx service has been built, and one nginx has multiple tomcat cluster environments. Problems encountered and solutions:
1. Install nginx
because it is installed on centOs7. Using yum installation, it is found that yum source does not have nginx.
Add the following RHEL extension sources
# yum localinstall http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm -y

RepoForge Source
yum localinstall http://apt.sw.be/redhat/el7/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm -y


2. After the installation is complete, modify nginx.conf, execute nginx -t and always appear
nginx: [emerg] unexpected "}" in /usr/local/nginx/conf/nginx.conf:44
Check that there is no error, then ftp down and format Once the file is OK.
Reload the configuration file
nginx -s reload
restart
service nginx stop
service nginx start

3. An error was found in the proxy:
502 Bad Gateway
The log was checked and found to be a permission problem (13: Permission denied). Modify the user nginx at the
beginning of the configuration file to user root (because I started it with the root user). After the modification, I found that the error remains the same. After searching, it turns out that SELinux only allows the web server outbound port to connect to limited ports by default. Use the command

semanage port --list|grep http_port_t
View allowed ports
If you need to increase the port of the proxy, use
semanage port --add --type http_port_t --proto tcp 11080
to increase. The example adds port 11080 and passes it after
modification .

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326988801&siteId=291194637