相关疑难解决方法(0)

带有PHP的Nginx子目录根

我在 docker 容器中运行 nginx。我想要一个子目录/web/来访问我的个人文件和项目。它还应该支持 php。

下面是我正在运行但domain-a.com/web一直导致 404。PHP 被确认工作,因为相同的 php 块在子域上工作但直接在server{}块中工作。

http {

    server {
        listen      443 ssl;
        server_name domain-a.com domain-b.com;

        # Mime types
        include /etc/nginx/confs/mime.types;

        # SSL
        include /etc/nginx/confs/nginx-ssl.conf;

        # Proxy to organizr
        # This works
        location / {
            proxy_pass http://organizr/;
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;

            # HTTP 1.1 support
            proxy_http_version 1.1;
            proxy_set_header Connection "";
        }

        # Root folder for my personal files/projects
        # Doesn't work
        location …
Run Code Online (Sandbox Code Playgroud)

php nginx nginx-location

3
推荐指数
1
解决办法
2676
查看次数

使用 Nginx 的多个 Laravel 应用程序 - Windows

我的服务器计算机上有两个不同的 Laravel 应用程序。

他们位于:

D:/APPLICATION/application1

D:/APPLICATION/application2

以下是我的nginx.conf内容:

server {
        listen       80;
        server_name  localhost;        

        location / {
        root "D:/APPLICATION/application1/public";
        try_files $uri $uri/ /index.php?$query_string;
        index index.php index.html index.htm;

        location ~ \.php$ {
            try_files $uri /index.php = 404;
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }

        }

    location ^~ /application2 {
        alias "D:/APPLICATION/application2/public";     
        try_files $uri $uri/ /index.php?$query_string;
        index index.php index.html index.htm;

            location ~ \.php$ {
               try_files $uri /index.php = 404;
               fastcgi_pass  127.0.0.1:9000;
               fastcgi_index index.php;
               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
               include …
Run Code Online (Sandbox Code Playgroud)

windows nginx laravel

1
推荐指数
1
解决办法
3862
查看次数

标签 统计

nginx ×2

laravel ×1

nginx-location ×1

php ×1

windows ×1