网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

linuxnginx配置反向代理-创新互联

创新互联公司专注为客户提供全方位的互联网综合服务,包含不限于成都网站建设、成都做网站、蓝山网络推广、微信小程序定制开发、蓝山网络营销、蓝山企业策划、蓝山品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们大的嘉奖;创新互联公司为所有大学生创业者提供蓝山建站搭建服务,24小时服务热线:13518219792,官方网址:www.cdcxhl.com

查找  find / -name nginx.conf

[root@test ~]# cd /etc/nginx/conf.d
[root@test conf.d]# vi/usr/local/nginx/conf/nginx.conf
[root@test conf.d]# vi nginx.conf
[root@test conf.d]# find/ -name nginx.conf
/etc/nginx/nginx.conf
[root@test conf.d]# vi/etc/nginx/nginx.conf
[root@test conf.d]#
# For more information on configuration, see:
#* Official English Documentation: http://nginx.org/en/docs/#   * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log/var/log/nginx/error.log;
pid/run/nginx.pid;

# Loaddynamic modules. See /usr/share/doc/nginx/README.dynamic.
include/usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    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;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # Seehttp://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

"/etc/nginx/nginx.conf" 90L, 2469C

上面得到原始的 配置文件

修改文件后

server {

        listen80;

        server_name  www.xxx.com; #代理服务器本机的域名或者IP
#charset koi8-r; #access_log logs/host.access.log main;
location/ {
root html;
index index.html index.htm;
proxy_pass http://www.xxx.com;
}

:qw 回车

[root@test ~]# nginx -s reload 
[root@test~]# vi /etc/nginx/nginx.conf
[root@test~]# vi /etc/nginx/nginx.conf
[root@test~]# nginx -s reload 
[root@test~]#

重启 nginx

nginx -s reload

2.添加多个一个路由,注意:这里 buy必须是域名下对应的文件夹路径

location /buy { 
   root html; 
  index index.html index.htm;
   proxy_pass http://www.xxx.com;}

当访问 http://n2.xxxxx.cn/buy 则是第二个


本文名称:linuxnginx配置反向代理-创新互联
网站URL:http://bjjierui.cn/article/deihhj.html

其他资讯