Disclaimer: Respect bloggers original articles, please indicate the source. If wrong, correct me hope. Contact: [email protected] https://blog.csdn.net/Supreme_Sir/article/details/80466599
Please carry out the steps of the installation and configuration to Tomcat in Linux: PS
1, first nginx
uploaded to linux
the
2, extract nginx
3, compilednginx
-
Installation dependencies
yum install gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
-
First enter the
nginx
directory compiler execution./configure
4, the installation nginx
make
make install
5, start nginx
Enter nginx
the directory and execute
./nginx
6, the port number 80
released
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
The setting is added to the firewall rules
/etc/rc.d/init.d/iptables save
7, modify conf
directory nginx.conf
files
code show as below:
#gzip on;
upstream server_xxx{
#通过 weight 属性可设置被代理服务器权重,值越大权重越高,越容易被访问(可省略)
server 127.0.0.1:8080 weight=1;
server 127.0.0.1:8081 weight=2;
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
#代理单个服务器
#proxy_pass http://localhost:8080;
#代理集群
proxy_pass http://server_xxx;
}
#error_page 404 /404.html;
8, reload nginx
the configuration file
./nginx -s reload
PS: content of the discussion from the network