当前位置:首页 > CN2资讯 > 正文内容

Nginx 配置 HTTP 代理

1天前CN2资讯

配置如下

 

#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;

#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 logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

upstream tomcats{
# # server 172.17.127.160:8080 weight=5;
## #server https:///audit/;
# server 172.17.127.160:8081;
# server 172.17.127.160:8082;
# server 172.17.127.160:8083;
# server 172.17.127.153:8087;
# server ;
server ;
}


server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
#root html;
proxy_pass http://tomcats;

index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# 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 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}


}

 



    你可能想看:

    扫描二维码推送至手机访问。

    版权声明:本文由皇冠云发布,如需转载请注明出处。

    本文链接:https://www.idchg.com/info/32167.html

    分享给朋友:

    “Nginx 配置 HTTP 代理” 的相关文章

    GIA VPS服务器:高速稳定的理想选择及价格性能分析

    GIA VPS服务器概述 在选择服务器时,GIA VPS服务器越来越受到关注。我之前在寻找合适的VPS时,了解到GIA VPS是一个非常不错的选择。它采用了CN2 GIA线路,提供了高效、稳定的网络连接。对我来说,网络的速度和稳定性是使用服务器的关键因素,而GIA VPS服务器在这两个方面表现都很优...

    DC2:动画创作、网络安全与汽车文化的多重魅力探索

    DC2 可谓是一个充满魔力的词汇,它在不同的领域中有着不同的意义。这种多样性让它成为了动画爱好者、汽车迷,甚至网络安全专家的共同话题。我对这些含义的探索,给我带来了许多启发和乐趣,让我对这个小小的组合字母有了更深刻的理解。 首先,提到 DC2,许多人可能会想到 DC2 动画软件。这款软件不仅在手机动...

    外网域名哪里最便宜?选择最佳注册商的指南

    1.1 什么是外网域名注册商? 外网域名注册商是提供域名注册服务的公司,它们通常允许用户选择和注册自己希望拥有的网站地址。这些注册商的作用不仅仅是处理注册申请。它们还提供一系列相关服务,例如域名转移、续费、DNS管理以及隐私保护等。选择合适的注册商对于建立网站而言非常重要,它直接影响到域名的成本和后...

    低价VPS:选择适合你的经济实惠虚拟专用服务器

    在开始聊低价VPS之前,让我们先了解一下什么是VPS。VPS,全名为虚拟专用服务器,是一种将物理服务器分割为多个虚拟服务器的技术。每个虚拟服务器都拥有独立的操作系统、资源和配置。这种技术为用户提供了一个相对便宜但又灵活的服务器环境,方便用户进行各种操作,比如搭建网站、应用程序和数据库等。 说到低价V...

    如何选择合适的永久云盘服务:功能、价格与用户体验分析

    我时常会想,生活中有多少资料是我们需要长期保存的。无论是珍贵的照片,还是重要的工作文档,永久云盘的出现无疑让我们的数据存储变得更加安全和可靠。那么,什么是永久云盘呢?简单来说,永久云盘是一种云存储服务,它允许用户将文件上传至云端,并承诺这些文件将在很长一段时间内保持可用。这意味着你再也不必担心电脑崩...

    如何选择适合自己的主机:从需求分析到性能优化

    在选购主机之前,我总是会先认真思考我的需求。明确自己选择主机的目的和使用场景是至关重要的。如果你是为了玩游戏而购置主机,那么高性能显卡和处理器就显得尤为重要。而如果只是用来办公、浏览网页或者看视频,其实选择相对普通的配置就可以满足日常需求。确定这些后,才能更有针对性地进行主机的选择。 接下来,我们需...