nginx常用代理配置

迈不过友情╰ 2022-06-09 11:50 317阅读 0赞

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

  1. \#log\_format main '$remote\_addr - $remote\_user \[$time\_local\] "$request" '
  2. \# '$status $body\_bytes\_sent "$http\_referer" '
  3. \# '"$http\_user\_agent" "$http\_x\_forwarded\_for"';
  4. \#access\_log logs/access.log main;
  5. sendfile on;
  6. \#tcp\_nopush on;
  7. \#keepalive\_timeout 0;
  8. keepalive\_timeout 65;
  9. \#gzip on;
  10. upstream my\_server \{

server 127.0.0.1:80;
keepalive 2000;
}
server {
listen 8080;
server_name localhost;

  1. \#charset koi8-r;
  2. \#access\_log logs/host.access.log main;
  3. location / \{
  4. proxy\_pass http://10.10.24.43:8080;

proxy_set_header Host $host:$server_port;
}

location /eiap-plus/ {
proxy_pass http://my\_server;
proxy_set_header Host $host:$server_port;
}
location /example/ {
proxy_pass http://my\_server;
proxy_set_header Host $host:$server_port;
}
#error_page 404 /404.html;

  1. \# redirect server error pages to the static page /50x.html
  2. \#
  3. error\_page 500 502 503 504 /50x.html;
  4. location = /50x.html \{
  5. root html;
  6. \}
  7. \# proxy the PHP scripts to Apache listening on 127.0.0.1:80
  8. \#
  9. \#location ~ \\.php$ \{
  10. \# proxy\_pass http://127.0.0.1;
  11. \#\}
  12. \# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  13. \#
  14. \#location ~ \\.php$ \{
  15. \# root html;
  16. \# fastcgi\_pass 127.0.0.1:9000;
  17. \# fastcgi\_index index.php;
  18. \# fastcgi\_param SCRIPT\_FILENAME /scripts$fastcgi\_script\_name;
  19. \# include fastcgi\_params;
  20. \#\}
  21. \# deny access to .htaccess files, if Apache's document root
  22. \# concurs with nginx's one
  23. \#
  24. \#location ~ /\\.ht \{
  25. \# deny all;
  26. \#\}
  27. \}
  28. \# another virtual host using mix of IP-, name-, and port-based configuration
  29. \#
  30. \#server \{
  31. \# listen 8000;
  32. \# listen somename:8080;
  33. \# server\_name somename alias another.alias;
  34. \# location / \{
  35. \# root html;
  36. \# index index.html index.htm;
  37. \# \}
  38. \#\}
  39. \# HTTPS server
  40. \#
  41. \#server \{
  42. \# listen 443 ssl;
  43. \# server\_name localhost;
  44. \# ssl\_certificate cert.pem;
  45. \# ssl\_certificate\_key cert.key;
  46. \# ssl\_session\_cache shared:SSL:1m;
  47. \# ssl\_session\_timeout 5m;
  48. \# ssl\_ciphers HIGH:!aNULL:!MD5;
  49. \# ssl\_prefer\_server\_ciphers on;
  50. \# location / \{
  51. \# root html;
  52. \# index index.html index.htm;
  53. \# \}
  54. \#\}

}

发表评论

表情:
评论列表 (有 0 条评论,317人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Nginx 配置

    Nginx是web服务、反向代理、缓存、负载平衡、媒体流等方面的开源软件,同时也提供了 IMAP/POP3/SMTP 服务,其因丰富的功能集、稳定性、示例配置文件和低系统资源的