CentOS7 安装Nginx

1.安装

yum install epel-release

yum install nginx

2.启动

systemctl start nginx

3.修改配置

vim /etc/nginx/nginx.conf

// 连接数

events {

    use epoll;
    worker_connections  1024;
}

// 阻止通过IP或未配置的域名访问

server {

    listen 80 default;
    server_name _;
    return 500;
}

//可配置多个代理服务

server {

listen       80;

 

server_name  www.a.com;

resolver 114.114.114.114 8.8.8.8 valid=60s;

resolver_timeout 3s;

set $b "www.b.com:1234";

location / {  

proxy_pass http://$b;

client_max_body_size 500m;

proxy_connect_timeout 90;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

}

阅读更多
上一篇CentOS7卸载MySql
下一篇CentOS7 添加系统服务(systemctl)
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭