linuxnginx配置反向代理-创新互联
创新互联公司专注为客户提供全方位的互联网综合服务,包含不限于成都网站建设、成都做网站、蓝山网络推广、微信小程序定制开发、蓝山网络营销、蓝山企业策划、蓝山品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们大的嘉奖;创新互联公司为所有大学生创业者提供蓝山建站搭建服务,24小时服务热线:13518219792,官方网址:www.cdcxhl.com
当前题目:linuxnginx配置反向代理-创新互联
标题URL:http://lswzjz.com/article/deihhj.html
查找 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://lswzjz.com/article/deihhj.html