配置文件如下图
 
server {
listen 8080;
server_name 0.0.0.0;//这里可以配置相应域名
root /www/facei;
index index.html index.htm; access_log /var/log/nginx/facei.access.log;
error_log /var/log/nginx/facei.error.log; location / {
try_files $uri $uri /index.html =404;
} location ~ /(oauth|rest)\/ {
proxy_pass https://aip.baidubce.com;//反向代理配置
}
}

nginx 配置文件在centos上的路径是

/etc/nginx/conf.d/文件夹是其他站点的配置文件

/etc/nginx/nginx.conf  是配置文件

一般主配置都在nginx.conf里面,站点的配置都会放在conf.d里面。

下图是其他服务器的配置文件,待后续研究

user  sasuke;
worker_processes 2; error_log /home/sasuke/app/log/error.log;
pid /home/sasuke/app/log/nginx.pid;
worker_rlimit_nofile 65535; events {
use epoll;
worker_connections 1024;
accept_mutex on;
multi_accept on;
} http {
include /etc/nginx/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"';
log_format log404 '$status [$time_local] $remote_addr $host$request_uri $sent_http_location'; access_log /home/sasuke/app/log/access.log main;
access_log /home/sasuke/app/log/access.404.log log404; sendfile on;
tcp_nopush on; proxy_connect_timeout 90;
proxy_read_timeout 180;
proxy_send_timeout 180; keepalive_timeout 120;
tcp_nodelay on;
proxy_intercept_errors on; server {
listen 80;
server_name 10.20.24.131;
charset utf-8; access_log /home/sasuke/app/log/host.access.log main;
add_header 'Access-Control-Allow-Origin' '*'; location / {
index index.html index.htm;
} location ^~ /app/ {
proxy_pass http://10.20.24.131:9800;
proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} #location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css|json)$ {
# root /home/sasuke/app/web/www;
# expires -1;
#} location ~ .*$ {
root /home/sasuke/app/web/www;
expires -1;
}
} }

服务器上nginx.conf 的配置文件如下

Last login: Tue Jun 12 09:58:04 on ttys001
C02VQ00YHTD7:~ gaoyizhen736$ ssh root@43.240.128.93
root@43.240.128.93's password:
harset utf-8; access_log /home/sasuke/app/log/host.access.log main;
add_header 'Access-Control-Allow-Origin' '*'; location / {
index index.html index.htm;
} location ^~ /app/ {
proxy_pass http://10.20.24.131:9800;
proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} #location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css|json)$ {
# root /home/sasuke/app/web/www;
# expires -1;
#} location ~ .*$ {
root /home/sasuke/app/web/www;
expires -1;
}
} } Permission denied, please try again.
root@43.240.128.93's password:
Last failed login: Tue Jun 12 10:09:26 CST 2018 from 101.89.64.6 on ssh:notty
There were 2 failed login attempts since the last successful login.
Last login: Tue Jun 12 09:58:58 2018 from 101.89.64.6
WARNING: If you are not authorized to access this private computer system, disconnect now. All activities on this system will be monitored and recorded without prior notification or permission!
**************************************************************************
* *
*Attention: Auditing process will report your every action! *
*Warning: Don't delete any files in directory /root/slogs!! *
* *
* -PING AN INSURANCE (GRP) COMPANY OF CHINA,LTD.*
**************************************************************************
Script started, file is /root/slogs/2018-06-12_10:09:37pts-0root.log
[root@ECA-LJ3600096 ~]# cd /
[root@ECA-LJ3600096 /]# cd etc/nginx
[root@ECA-LJ3600096 nginx]# ls
conf.d koi-utf scgi_params
default.d koi-win scgi_params.default
fastcgi.conf mime.types uwsgi_params
fastcgi.conf.default mime.types.default uwsgi_params.default
fastcgi_params nginx.conf win-utf
fastcgi_params.default nginx.conf.default
[root@ECA-LJ3600096 nginx]# vim nginx.conf # For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/ user root;
#user nginx;//权限不够改成user root 重启的时候需要带上sudo
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid; # Load dynamic modules. See /usr/share/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;
  

nginx --反向代理配置文件的更多相关文章

  1. nginx.conf nginx反向代理配置文件

    nginx反向代理配置文件 nginx.conf proxy_default.conf proxy.conf vhost/*.conf upstream/*.conf cache/*.conf ngi ...

  2. nginx - 反向代理 - 配置文件 header - 日志log格式

    server { listen ; server_name paas.service.consul; client_max_body_size 512m; access_log /data/bkdat ...

  3. nginx - 反向代理 - 配置文件模板 - nginx 代理tcp的服务 - 部署示意图

    danjan01deiMac:~ danjan01$ cat /usr/local/etc/nginx/nginx.conf|grep -v '^$' worker_processes 1; even ...

  4. Nginx反向代理配置文件

    server { listen ; server_name ; root E:/Upays/public/; index index.php index.html; log_not_found off ...

  5. Nginx反向代理配置可跨域

    由于业务需要,同一项目中的前端代码放在静态环境中,而后端代码放在tomcat中,但此时问题却出现了:前端使用ajax请求后端获取数据时出现如下报错 XMLHttpRequest cannot load ...

  6. 十.nginx反向代理负载均衡服务实践部署

    期中集群架构-第十章-nginx反向代理负载均衡章节章节====================================================================== 0 ...

  7. linux篇—Nginx反向代理负载均衡

    一.环境准备 反向代理功能架构 3台web服务器,组建出web服务器集群 web01 10.0.0.7 172.16.1.7 web02 10.0.0.8 172.16.1.8 web03 10.0. ...

  8. nginx反向代理出现了代理的端口号

    nginx反向代理显示了代理的端口号 nginx反向代理配置文件 upstream mall { server 1.1.1.1:10261 weight=1; } server { listen 80 ...

  9. 使用nginx反向代理到不同服务器(共享同一端口)配置文件

    使用nginx反向代理到不同服务器(共享同一端口)配置文件 https://blog.csdn.net/wang_k_123/article/details/72779443 https://www. ...

随机推荐

  1. Android studio启动后卡在refreshing gradle project

    这个问题几乎每个刚使用Android studio的同学都会碰到过,网上有各式各样的方法,有的说使用本地gradle,我试过多次,每次启动Android studio时还是会检查更新,所以根本上解决的 ...

  2. 重写 Ext.form.field 扩展功能

    直接代码,放项目overrides文件夹中即可 //重写类 表单父类 //支持allowBlank动态绑定 Ext.define("override.form.field.Base" ...

  3. Mysql的复杂语句

    简单的crud操作很容易,但是对于嵌套的查询语句,多表查询语句,以及条件查询语句,这些都很复杂,需要不断练习. limit a,b: 从a开始,长度为b. SELECT * FROM tb_quali ...

  4. day_5.21 py 高级编程

    1.禁止模块之间的循环调用 2.浅拷贝    只拷贝引用!!\ 3. 深拷贝  只要里面有引用就继续拷贝 4.copy,copy() 5. '''2018-5-21 11:39:52就业班 py高级 ...

  5. 201621123049 《Java程序设计》第1周学习总结

    一. 本周学习总结 JDK,JRE,JVM等基本概念 怎么学好java???不,是怎么才能应用好??? 编程!编程!编程! 思考->设计->解决问题 二. 书面作业 1.虚拟机 1.1 执 ...

  6. 安装了nodejs后在命令行运行npm报错

    安装了nodejs后在命令行运行npm报错:Error: Cannot find module 'internal/util/types' 解决方法:删除目录“C:\Users\mengxiaobo\ ...

  7. php实现简单消息发送+极光推送系统

    前几天刚写完的一个东西,写的比较简单,没有使用其他插件,原生php+计划任务实现 极光推送的代码 /* $receiver="registration_id" : [ " ...

  8. ASP.NET Core奇遇记:无用户访问,CPU却一直100%

    这是5月11日遇到的一个问题,1台1核1G阿里云Linux服务器运行着生产环境中的ASP.NET Core站点,出现CPU 100%问题. 开始以为是这台服务器负载高引起的,于是将这台服务器从负载均衡 ...

  9. Exception 02 : java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.Driver

    异常名称 java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.Driver 异常详细信息 ...

  10. zabbix自动发现主机并加入组绑定模板

    在被监控主机多的情况下,怎样将这些主机加入zabbix server进行监控呢?下面将介绍下zabbix自动发现功能 1.创建自动发现规则 创建“规则名称,配置ip范围及检查方式”,点击“增加”,完成 ...