您的位置:首页 > 运维架构 > Nginx

nginx 配置文件和常用命令

2014-11-14 16:14 405 查看
配置文件名称 《《nginx.conf》》

keepalive_timeout 65;

#gzip on;

# another virtual host using mix of IP-, name-, and port-based configuration

#

#server {

# listen 8000;

# listen somename:8080;

# server_name somename alias another.alias;

# location / {

# root html;

# index index.html index.htm;

# }

#}

# HTTPS server

#

#server {

# listen 443;

# server_name localhost;

# ssl on;

# ssl_certificate cert.pem;

# ssl_certificate_key cert.key;

# ssl_session_timeout 5m;

# ssl_protocols SSLv2 SSLv3 TLSv1;

# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;

# ssl_prefer_server_ciphers on;

# location / {

# root html;

# index index.html index.htm;

# }

#}

include zdhc/*.conf;

}

total 16

keepalive_timeout 65;

#gzip on;

# another virtual host using mix of IP-, name-, and port-based configuration

#

#server {

# listen 8000;

# listen somename:8080;

# server_name somename alias another.alias;

# location / {

# root html;

# index index.html index.htm;

# }

#}

# HTTPS server

#

#server {

# listen 443;

# server_name localhost;

# ssl on;

# ssl_certificate cert.pem;

# ssl_certificate_key cert.key;

# ssl_session_timeout 5m;

# ssl_protocols SSLv2 SSLv3 TLSv1;

# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;

# ssl_prefer_server_ciphers on;

# location / {

# root html;

# index index.html index.htm;

# }

#}

include zdhc/*.conf;

下面<<zdhc.conf>>配置信息

upstream zdhc{

ip_hash;

server localhost:8081;

server localhost:8082;

server localhost:8083;

server localhost:8084;

server localhost:8085;

server localhost:8086;

server localhost:8087;

server localhost:8088;

server localhost:8089;

server localhost:8090;

}

server

{

listen 80;

server_name 10.251.4.121;

location / {

proxy_pass http://zdhc;
proxy_pass_header Server;

proxy_set_header Host $http_host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Scheme $scheme;

proxy_next_upstream error;

proxy_set_header Host $host;

}

}

建立软连接 ln -s /**/**/nginx nginx

启动命令 : nginx

重启命令 : nginx -s reload
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: