1. 1 不可撤销
  2. 2 小年兽 程嘉敏
  3. 3 手放开 李圣杰
  4. 4 迷人的危险3(翻自 dance flow) FAFA
  5. 5 山楂树之恋 程佳佳
  6. 6 summertime cinnamons / evening cinema
  7. 7 不谓侠(Cover 萧忆情Alex) CRITTY
  8. 8 神武醉相思(翻自 优我女团) 双笙
  9. 9 空山新雨后 音阙诗听 / 锦零
  10. 10 Wonderful U (Demo Version) AGA
  11. 11 广寒宫 丸子呦
  12. 12 陪我看日出 回音哥
  13. 13 春夏秋冬的你 王宇良
  14. 14 世界が终わるまでは… WANDS
  15. 15 多想在平庸的生活拥抱你 隔壁老樊
  16. 16 千禧 徐秉龙
  17. 17 我的一个道姑朋友 双笙
  18. 18 大鱼  (Cover 周深) 双笙
  19. 19 霜雪千年(Cover 洛天依 / 乐正绫) 双笙 / 封茗囧菌
  20. 20 云烟成雨(翻自 房东的猫) 周玥
  21. 21 情深深雨濛濛 杨胖雨
  22. 22 Five Hundred Miles Justin Timberlake / Carey Mulligan / Stark Sands
  23. 23 斑马斑马 房东的猫
  24. 24 See You Again Wiz Khalifa / Charlie Puth
  25. 25 Faded Alan Walker / Iselin Solheim
  26. 26 Natural J.Fla
  27. 27 New Soul Vox Angeli
  28. 28 ハレハレヤ(朗朗晴天)(翻自 v flower) 猫瑾
  29. 29 像鱼 王贰浪
  30. 30 Bye Bye Bye Lovestoned
  31. 31 Blame You 眠 / Lopu$
  32. 32 Believer J.Fla
  33. 33 书信 戴羽彤
  34. 34 柴 鱼 の c a l l i n g【已售】 幸子小姐拜托了
  35. 35 夜空中最亮的星(翻自 逃跑计划) 戴羽彤
  36. 36 慢慢喜欢你 LIve版(翻自 莫文蔚) 戴羽彤
  37. 37 病变(翻自 cubi) 戴羽彤
  38. 38 那女孩对我说 (完整版) Uu
  39. 39 绿色 陈雪凝
  40. 40 月牙湾 LIve版(翻自 F.I.R.) 戴羽彤
夜空中最亮的星(翻自 逃跑计划) - 戴羽彤
00:00 / 04:10

夜空中最亮的星 能否听清

那仰望的人 心底的孤独和叹息

夜空中最亮的星 能否记起

那曾与我同行 消失在风里的身影

我祈祷拥有一颗透明的心灵

和会流泪的眼睛

给我再去相信的勇气

越过谎言去拥抱你

每当我找不到存在的意义

每当我迷失在黑夜里

噢喔喔 夜空中最亮的星

请指引我靠近你

夜空中最亮的星 是否知道

那曾与我同行的身影 如今在哪里

夜空中最亮的星 是否在意

是等太阳先升起 还是意外先来临

我宁愿所有痛苦都留在心底

也不愿忘记你的眼睛

哦 给我再去相信的勇气

哦 越过谎言去拥抱你

每当我找不到存在的意义

每当我迷失在黑夜里

噢喔喔 夜空中最亮的星

请照亮我向前行 哒~

我祈祷拥有一颗透明的心灵

和会流泪的眼睛 哦

给我再去相信的勇气

哦 越过谎言去拥抱你

每当我找不到存在的意义

每当我迷失在黑夜里

噢喔喔 夜空中最亮的星

请照亮我向前行

nginx安装配置

安装

linux

nginx可以使用各平台的默认包来安装,这里介绍的是使用源码编译安装,包括具体的编译参数信息。

正式开始前,编译环境gcc g++ 开发库之类的需要提前装好,这里默认你已经装好。

ububtu平台编译环境可以使用以下指令:

$ apt-get install build-essentialapt-get install libtool

centos平台编译环境使用如下指令

安装make:

$ yum -y install gcc automake autoconf libtool make

安装g++:

$ yum install gcc gcc-c++

下面正式开始
---------------------------------------------------------------------------
一般我们都需要先装pcre, zlib,前者为了重写rewrite,后者为了gzip压缩。

1.选定源码目录

可以是任何目录,本文选定的是/usr/local/src

$ cd /usr/local/src

2.安装PCRE库

https://ftp.pcre.org/pub/pcre/ 下载最新的 PCRE 源码包,使用下面命令下载编译和安装 PCRE 包:

$ cd /usr/local/src
$ wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz 
$ tar -zxvf pcre-8.44.tar.gzcd pcre-8.44
$ ./configure
$ make
$ make install

3.安装zlib库

http://zlib.net/zlib-1.2.11.tar.gz 下载最新的 zlib 源码包,使用下面命令下载编译和安装 zlib包:

$ cd /usr/local/src 
$ wget http://zlib.net/zlib-1.2.11.tar.gz
$ tar -zxvf zlib-1.2.11.tar.gz
$ cd zlib-1.2.11
$ ./configure
$ make
$ make install

4.安装ssl(某些vps默认没装ssl)

$ cd /usr/local/src
$ wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
$ tar -zxvf openssl-1.1.1g.tar.gz

5.安装nginx

Nginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来选择这两个版本的其中一个,下面是把 Nginx 安装到 /usr/local/nginx 目录下的详细步骤:

$ cd /usr/local/src
$ wget http://nginx.org/download/nginx-1.18.0.tar.gz
$ tar -zxvf nginx-1.18.0.tar.gz
$ cd nginx-1.18.0 
$ ./configure --sbin-path=/usr/local/nginx/nginx \--conf-path=/usr/local/nginx/nginx.conf \--pid-path=/usr/local/nginx/nginx.pid \--with-http_gzip_static_module \--with-http_stub_status_module \--with-file-aio \--with-http_realip_module \--with-http_ssl_module \--with-pcre=/usr/local/src/pcre-8.44 \--with-zlib=/usr/local/src/zlib-1.2.11 \--with-openssl=/usr/local/src/openssl-1.1.1g 
$ make -j2
$ make install
  • --with-pcre=/usr/local/src/pcre-8.44 指的是pcre-8.44 的源码路径。
  • --with-zlib=/usr/local/src/zlib-1.2.11指的是zlib-1.2.11 的源码路径。

安装成功后 /usr/local/nginx 目录下如下:

fastcgi.conf            koi-win         		nginx.conf.default
fastcgi.conf.default    logs        			scgi_params
fastcgi_params     		mime.types     			scgi_params.default
fastcgi_params.default  mime.types.default 		uwsgi_params
html          			nginx        			uwsgi_params.default
koi-utf         		nginx.conf    		 	win-utf

6.启动

启动就很简单了,linux环境下直接执行如下命令即可启动nginx:

$ nginx

如果提示不是有效的命令,你可以进入到nginx的安装目录下进行启动,比如我的路径/usr/local/nginx ,然后执行如上命令即可启动,默认端口80,然后你就可以在在浏览器输入localhost或者127.0.0.1来访问nginx了,可以在浏览器看下效果:

windows

相比linux,windows下相对简单,当然前提条件是你想开箱即用,而不是在本地编译。

1.下载nginx

访问如下路径,选择对应的版本进行下载:

http://nginx.org/en/download.html

2. 解压

解压刚刚下载的windows版本nginx,你可以看到如下目录结构:

目录与Linux下一致,这里就不做过多说明。

3.启动

相比linux,Windows环境下就简单的多,直接双击nginx.exe文件即可启动。

配置文件

打开conf下的nginx.conf配置文件,默认配置应该是这样的:

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;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            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;
    #    }
    #}

}

nginx 文件结构

...              #全局块

events {         #events块
   ...
}

http      #http块
{
    ...   #http全局块
    server        #server块
    { 
        ...       #server全局块
        location [PATTERN]   #location块
        {
            ...
        }
        location [PATTERN] 
        {
            ...
        }
    }
    server
    {
      ...
    }
    ...     #http全局块
}
  • 1、全局块:配置影响nginx全局的指令。一般有运行nginx服务器的用户组,nginx进程pid存放路径,日志存放路径,配置文件引入,允许生成worker process数等。
  • 2、events块:配置影响nginx服务器或与用户的网络连接。有每个进程的最大连接数,选取哪种事件驱动模型处理连接请求,是否允许同时接受多个网路连接,开启多个网络连接序列化等。
  • 3、http块:可以嵌套多个server,配置代理,缓存,日志定义等绝大多数功能和第三方模块的配置。如文件引入,mime-type定义,日志自定义,是否使用sendfile传输文件,连接超时时间,单连接请求数等。
  • 4、server块:配置虚拟主机的相关参数,一个http中可以有多个server。
  • 5、location块:配置请求的路由,以及各种页面的处理情况。

其中基本的配置结构是这样的:

server {
        listen       80;   # 监听的端口
        server_name  localhost; # 监听地址

        #charset koi8-r;  # 编码

        #access_log  logs/host.access.log  main; # 访问日志

        location / {  #转发规则
            root   html;
            index  index.html index.htm;
        }

下面演示实际应用中的简单配置

路由配置示例

如当前nginx服务器地址如下:

127.0.0.35

请求转发

如下配置就是将127.0.0.31:8720服务器上的所有服务以test开头的服务,将通过127.0.0.35来访问,如127.0.0.35/test,实际访问的就是http://127.0.0.31:8720/test127.0.0.35/test-pc实际访问的是

http://127.0.0.31:8720/test-pc
location /test {
        proxy_pass  http://127.0.0.31:8720;
  }

nginx中配置proxy_pass时,当在后面的url加上了"/",相当于是绝对根路径,则nginx不会把location中匹配的路径部分代理走;如果没有"/",则会把匹配的路径部分也给代理走。

如下面的配置,如果访问的是/test-query/user,跳转的真实路径应该是http://127.0.0.41:9902/user,而不会加上匹配值/test-query

location /test-query {
      proxy_pass  http://127.0.0.41:9902/;
}

开启状态页

location /status {  
  stub_status on;   	#表示开启stubStatus的工作状态统计功能。
  access_log off;   	#access_log off; 关闭access_log 日志记录功能。
  #auth_basic "status";   							#auth_basic 是nginx的一种认证机制。
  #auth_basic_user_file conf/htpasswd;	#用来指定密码文件的位置。
}

单点登陆token共享配置

 server {
    listen 8080;
      server_name 127.0.0.1:8080;

      underscores_in_headers on;

      location /test/ {			
        proxy_redirect off;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_pass http://127.0.0.1:8083;
      }

      location /test-pc/ {				
        proxy_redirect off;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_pass http://127.0.0.1:8083;
      }

      location /sso/ {				
        proxy_redirect off;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_pass http://127.0.0.1:8088;
      }
				
      location /api/ {
       if ( $request_method = 'OPTIONS' ) { 
        add_header Access-Control-Allow-Origin $http_origin; 
        add_header Access-Control-Allow-Headers Authorization,access-token,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,X-Data-Type,X-Requested-With; 
        add_header Access-Control-Allow-Methods GET,POST,OPTIONS,HEAD,PUT; 
        add_header Access-Control-Allow-Credentials true; 
        add_header Access-Control-Allow-Headers X-Data-Type,X-Auth-Token;
        return 200;
      }
      proxy_next_upstream http_502 http_504 error timeout invalid_header;				
        proxy_redirect off;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_pass http://127.0.0.1:8081;
      }		
    }

常用命令

nginx -s reload ## 重新载入配置文件
nginx -s reopen ## 重启 Nginx
nginx -s stop # #停止 Nginx
posted @ 2020-08-22 10:15  云中志  阅读(884)  评论(0编辑  收藏  举报