nginx配置文件2

作者:神秘网友 发布时间:2021-02-24 14:21:04

nginx配置文件2

server {
listen 80;
server_name 120.78.64.28;

location / {
limit_req zone=one ;
    root   /usr/local/nginx/html;
    index  index.html index.htm index.php;
#if ($http_user_agent ~* (mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)) { rewrite ^(.*) http://www.baidu.com$1 permanent; }
#default_type text/html;
#return 200 $remote_addr;
#return 200 $http_user_agent;
}
location /api {
rewrite ^/api/(.*)/(.*)/(.*)/(.*)$ /api/index.php$1=$2$3=$4 last; 
break;

}
location /cache {
expires 30m;
proxy_cache my_cache;

}
location /upstream {
default_type text/html;
return 200 $scheme$proxy_host$uri$is_args$args;
proxy_cache my_cache;
proxy_cache_valid any 1m;
proxy_cache_key $scheme$proxy_host$uri$is_args$args;
proxy_ignore_headers Cache-Control;
proxy_cache_bypass 1;

proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;	

proxy_next_upstream timeout;
proxy_next_upstream_tries 1;
proxy_next_upstream_timeout 1;
proxy_send_timeout 3;
proxy_read_timeout 4;
proxy_connect_timeout 3;
proxy_pass http://swoole_server;
}
location ~* ^.+\.(jpg|gif|png|swf|flv|wma|wmv|asf|mp3|mmf|zip|rar)$ {
valid_referers 120.78.64.28  www.baidu.com;
if ($invalid_referer) {
    return 200 $remote_addr;break;
}

}
error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /usr/local/nginx/html;
}

location ~ \.php$ {
    fastcgi_pass   120.78.64.28:9000;
fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /www/$fastcgi_script_name;
    include        fastcgi_params;
}

location =/test {
    default_type text/html;
    return 200 'test1';
}

location /test {
    default_type text/html;
    return 200 'test2';
}

}

nginx配置文件2 相关文章

  1. spring boot:从yaml配置文件中读取数据的四种方式(spring boot 2.4.3)

    一,从配置文件中读取数据有哪些方法 通常有3种用法: 1,直接使用value注解引用得到配置项的值 2, 封装到Component类中再调用: 可以通过value注解或ConfigurationProperties注解两种方式访问 3, 用Environment类从代码中直接访问 生产环境中推荐使用第二种

  2. Nginx做负载均衡,以及方式

    主要配置 http { upstream myhtml { server 106.52.147.100; server 106.52.147.101; } server { listen 80; server_name abc.wsycoon.cn; location / { proxy_buffering off; proxy_pass http://myhtml; } }} 1.轮询(down) 检查服务器是否有down,如果

  3. 使用 Serverless Wordpress 快速建站,只需三步

    WordPress 是使用 PHP 语言开发的博客平台,用户可以在支持 PHP 和 MySQL 数据库的服务器上架设属于自己的网站,也可以把 WordPress 当作一个内容管理系统(CMS)来使用。根据 W3techs 的统计,截至 2020 年 12 月,全球约 39.9% 的网站都使用 WordPress,无

  4. JVM两种运行模式Server与Client

    JVM有两种运行模式Server与Client。两种模式的区别在于,Client模式启动速度较快,Server模式启动较慢;但是启动进入稳定期长期运行之后Server模式的程序运行速度比Client要快很多。这是因为Server模式启动的JVM采用的是重量级的虚拟机,对程序采用了更多的

  5. c3p0配置Mysql数据源(加载配置文件方式)

    jdbc.properties 至于resource jdbc.properties 内容如下 jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/test jdbc.username=root jdbc.password=root @Test public void test1(){ /* * c3p0配置Mysql数据源(加载配置文件方式) *

  6. nginx使用域名监听80端口,指向不同服务器

    找到nginx.conf编辑 编辑完记得重启 #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; de

  7. 服务器重启后发现docker-compose的nginx重启失败: Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use

    服务器重启后执行 docker-compose up -d 报错: Starting nginx ... php is up-to-dateStarting nginx ... errorERROR: for nginx Cannot start service nginx: driver failed programming external connectivity on endpoint nginx (b2a83540af157cc42157760

  8. nginx动态增删upstream

    server:192.168.159.128 node-1:192.168.159.130 node-2:192.168.159.133 1.安装依赖包 yum install wget git openssl openssl-devel gcc pcre pcre-devel jemalloc jemalloc-devel 2.下载安装包 wget http://tengine.taobao.org/download/tengine-2.3.2.tar

  9. uni-app学习笔记(1)配置文件

    常用的配置信息 //页面配置 { "pages": [ { "path": "pages/index/index", "style": { "H5":{ } } }, { "path": "pages/login/login", "style": { ... } } ]} //全局样式常用设置 "globalStyle": { "navigationBarTextStyle": "black", |导航栏标题颜色及状

  10. mysql5.7解压版安装步骤

    # MySQL Server Instance Configuration File# ----------------------------------------------------------------------# Generated by the MySQL Server Instance Configuration Wizard### Installation Instructions# ---------------------------------

每天更新java,php,javaScript,go,python,nodejs,vue,android,mysql等相关技术教程,教程由网友分享而来,欢迎大家分享IT技术教程到本站,帮助自己同时也帮助他人!

Copyright 2020, All Rights Reserved. Powered by 跳墙网(www.tqwba.com)|网站地图|关键词