nginx部署

环境准备:
1.关闭firewalld
2.关闭selinux

一.安装nginx
yum -y install epel-release
yum -y install nginx

二.配置nginx主配置文件
cd /etc/nginx
mv nginx.conf nginx.conf.bak
vi /etc/nginx/nginx.conf

user nginx;
worker_processes 6;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
worker_rlimit_nofile 10240;

include /usr/share/nginx/modules/*.conf;

events {
use epoll;
worker_connections 5000;
}

http {
log_format main '$remote_addr - r e m o t e u s e r [ remote_user [ remoteuser[time_local] “KaTeX parse error: Double superscript at position 34: … '̲status b o d y b y t e s s e n t " body_bytes_sent " bodybytessent"http_referer” ’
‘“ h t t p u s e r a g e n t " " http_user_agent" " httpuseragent""http_x_forwarded_for”’;

access_log  /var/log/nginx/access.log  main;

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
keepalive_timeout   65;
types_hash_max_size 2048;

include             /etc/nginx/mime.types;
default_type        application/octet-stream;

include /etc/nginx/conf.d/*.conf;

}

三.配置nginx虚拟主机
vi /etc/nginx/conf.d/edoc2.conf
upstream edoc2 {
ip_hash;
server 1.1.1.1:80 weight=1 max_fails=1 fail_timeout=20;
server 1.1.1.2:80 weight=1 max_fails=1 fail_timeout=20;
server 1.1.1.3:80 weight=1 max_fails=1 fail_timeout=20;
}

server {
listen 80;
server_name doc2.wf.com ; ##填写域名

location / {
proxy_pass http://edoc2;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
client_max_body_size 0;
proxy_http_version 1.1;
proxy_request_buffering off;
#proxy_buffering off;
}

}
四. 修改服务器打开的最大文件句柄数
echo ‘* - nofile 65535’ >> /etc/security/limits.conf

五.启动nginx
systemctl start nginx
systemctl enable nginx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值