Amaze UI Logo

码动指尖



nginx部署站点(包括https等)

  server {

         listen 80;

         server_name nl.wyysdsa.cn;

         set $root /www/nl/public/;

         root $root;

         index index.php index.html index.htm;

        

        if (!-e $request_filename) {

           rewrite ^(.*)$ /index.php?s=$1 last;

           break;

        }

        

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {

                expires      30d;

        }

        

        location ~ .*\.(js|css)?$ {

                expires      12h;

        }

        location / {

            root   $root;

            index  index.html index.htm index.php;

            if (!-e $request_filename) {

              rewrite ^(.*)$ /index.php?s=$1 last;

              break;

            }

        }

        location ~ .+\.php($|/) {

            set $script $uri;

            set $path_info "";

            if ($uri ~ "^(.+\.php)(/.+)") {

               set $script $1;

               set $path_info $2;

            }

            root           $root;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php?IF_REWRITE=1;

            fastcgi_param    PATH_INFO    $path_info;

            fastcgi_param  SCRIPT_FILENAME  $root$fastcgi_script_name;

            include        fastcgi_params;

        }

    

    }



    server {

        listen 80;

        server_name cjy.suse.edu.cn;


        location / {

            proxy_pass http://61.139.105.154/;

        }


    }



负载均衡


    upstream nose.wyysdsa.cn{

         ip_hash;

         #server 119.29.199.38:2017;

         server 127.0.0.1:2017;

         #server 120.24.99.156:2017;

    }



nginx安装的时候需要安装的常用模块


--with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-file-aio --with-debug



nginx域名证书生成

如果没有安装letsencrypt

则执行

git clone https://github.com/letsencrypt/letsencrypt


cd letsencrypt


./certbot-auto --help all


否则

进入/home/www/的letsencrypt目录

执行

./certbot-auto certonly --standalone --email 1023767856@qq.com -d www.tan90.club -d nl.tan90.club





https 的配置


  server {

         listen 443;

         server_name nl.tan90.club;

         ssl on;

         ssl_certificate /etc/letsencrypt/live/www.tan90.club/fullchain.pem;

         ssl_certificate_key /etc/letsencrypt/live/www.tan90.club/privkey.pem;

         ssl_session_timeout 5m;

         ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

         ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;

         ssl_prefer_server_ciphers on;

         set $root /www/nl/public/;

         root $root;

         index index.php index.html index.htm;


        if (!-e $request_filename) {

           rewrite ^(.*)$ /index.php?s=$1 last;

           break;

        }


        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {

                expires      30d;

        }


        location ~ .*\.(js|css)?$ {

                expires      12h;

        }

        location / {

            root   $root;

            index  index.html index.htm index.php;

            if (!-e $request_filename) {

              rewrite ^(.*)$ /index.php?s=$1 last;

              break;

            }

        }

        location ~ .+\.php($|/) {

            set $script $uri;

            set $path_info "";

            if ($uri ~ "^(.+\.php)(/.+)") {

               set $script $1;

               set $path_info $2;

            }

            root           $root;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php?IF_REWRITE=1;

            fastcgi_param    PATH_INFO    $path_info;

            fastcgi_param  SCRIPT_FILENAME  $root$fastcgi_script_name;

            client_max_body_size 500m;

            include        fastcgi_params;

        }


    }


vue配合nginx进行项目部署以及开发

总配置文件   项目名.vue.conf

    server {

        listen 80;

        server_name lib.gz-zjqy.com;

        location /back/ {

                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:监听的端口/;

        }

        location / {

            proxy_pass http://127.0.0.1:8080/;

        }

 }

后台接口系统的配置

项目名.back.conf

  server {

         listen 监听的端口(不能是80端口,可以是其他端口,与vue.conf文件里的配置一样);

         server_name domian;

         set $root 项目路径;

         略······(就是一般的后台配置文件一样配置即可,可以将上面的http类型配置直接copy)

}

以上是暂时的,以后还待更新。


 nginx

作者  :  奕弈

喵喵喵,你在心上



评论


About ME

about me

奕弈

为了最初的心,努力奋斗,从不懈怠的学习。

我不想成为一个庸俗的人。十年百年后,当我们死去,质疑我们的人同样死去,后人看到的是裹足不前、原地打转的你,还是一直奔跑、走到远方的我?

Contact ME