标签:proxy ESS str eve 配置nginx base packages listen usr
配置nginx的yum源
vi /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
nginx -v
cd /etc/nginx/
vim nginx.conf#修改nginx主配置文件
cd /etc/nginx/conf.d/
cp default.conf my.conf
vi my.conf#定义新的服务器
listen 80 default_server;
server_name 192.168.2.188;
location / {
root /usr/share/nginx/a;
index index.html index.htm;
}
cd /usr/share/nginx/
mkdir a
vim a/index.html
nginx#启动nginx
nginx -s stop#停止nginx
访问192.168.2.188
配置反向代理
vim /etc/nginx/conf.d/fzjh.conf
upstream tomcatsvr{
server 192.168.30.17 weight=3;
server 192.168.30.27;
}
server {
listen 80 default_server;
server_name 192.168.2.188;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
proxy_pass http://tomcatsvr;
index index.html index.htm;
}
location /status {
stub_status;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
访问192.168.2.188
标签:proxy ESS str eve 配置nginx base packages listen usr
原文地址:https://www.cnblogs.com/fourw/p/11145883.html