Categories
nginx php

nginx 下 laravel 部署

server {
                listen       8080;
                server_name  laravel.localhost;

                client_max_body_size 10M;
                # Load configuration files for the default server block.

                

                location / {
                        root           D://robin-admin/public;
                        index  index.html index.htm index.php;
                        try_files $uri $uri/ /index.php?$query_string;
                }

                location ~ \.php$ {
                    root           D://robin-admin/public;
                    fastcgi_pass   127.0.0.1:9000;
                    fastcgi_index  index.php;
                    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                    include        fastcgi_params;
                }

                error_page 404 /404.html;
                        location = /40x.html {
                }

                error_page 500 502 503 504 /50x.html;
                        location = /50x.html {
                }
    }

nginx 根目录指向laravel 的下的public 文件夹

try_files $uri $uri/ /index.php?$query_string; 可以有效重新访问后缀(不需要显式指明php后缀)

Categories
nginx

windows 下 SC 命令

windows 下可以通过 sc 命令添加服务

sc create gogs start= auto binPath= ""C:\gogs\gogs.exe" web --config "C:\gogs\conf\app.ini""
sc create nginx start= auto binPath= ""C:\nginx\nginx.exe" -p  "C:\nginx"" DisplayName= nginx-server
Categories
nginx

nginx tcpip 代理

nginx stream 能提供基于tcpip的代理功能

stream {
        upstream redis {
                server 192.168.0.14:6379;
        }
        server {
                listen 6379;
                proxy_pass redis;

        }
}

定义stram模块 开始配置tcpip转发规则

定义的upstream redis 是一个只能内网访问的redis

server 模块表示对外的配置信息 上文就是把开通本机6379端口 代理redis服务器