概述
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
# 注意,这里的server名字即fgateway.mytest.com不能带下划线,有下划线则不能访问
upstream fgateway.mytest.com {
server 192.168.1.68:30001 weight=1;
server 192.168.1.69:30001 weight=1;
}
server {
listen 80;
server_name mytest.com;
location / {
#root /home/project/pa;
#index index.html;
proxy_pass http://192.168.1.70;
}
}
server {
listen 80;
server_name gateway.mytest.com;
location / {
#root /home/project/pa;
#index index.html;
proxy_pass http://fgateway.mytest.com;
#proxy_pass http://192.168.1.69:30001;
proxy_connect_timeout 1; #单位为秒
proxy_send_timeout 1;
proxy_read_timeout 1;
}
}
}
最后
以上就是大方大炮为你收集整理的nginx的简单配置的全部内容,希望文章能够帮你解决nginx的简单配置所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复