标签:local name https microsoft target class ref ram default
1.静态服务器
server { listen 80; # 端口号 location / { root /usr/share/nginx/html; # 静态文件路径 } }
2.反向代理
server { listen 80; location / { proxy_pass http://192.168.20.1:8080; # 应用服务器HTTP地址 } }
3.负载均衡
upstream myapp { server 192.168.20.1:8080; # 应用服务器1 server 192.168.20.2:8080; # 应用服务器2 } server { listen 80; location / { proxy_pass http://myapp; } }
4.虚拟主机
server { listen 80 default_server; server_name _; return 444; # 过滤其他域名的请求,返回444状态码 } server { listen 80; server_name www.aaa.com; # www.aaa.com域名 location / { proxy_pass http://localhost:8080; # 对应端口号8080 } } server { listen 80; server_name www.bbb.com; # www.bbb.com域名 location / { proxy_pass http://localhost:8081; # 对应端口号8081 } }
5.FastCGI
server { listen 80; location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME /PHP文件路径$fastcgi_script_name; # PHP文件路径 fastcgi_pass 127.0.0.1:9000; # PHP-FPM地址和端口号 # 另一种方式:fastcgi_pass unix:/var/run/php5-fpm.sock; } }
1
标签:local name https microsoft target class ref ram default
原文地址:http://www.cnblogs.com/legion/p/7148802.html