如何通过nginx反向代理向Apache2提供Laravel文件

时间:2017-12-02 19:39:24

标签: apache laravel nginx reverse

我有一个设置,其中运行nginx的服务器将作为前端,并且还有一个负载均衡器,它将作为后端的许多其他服务器的上游。 我目前所拥有的是运行nginx的web服务器和反向代理到在端口8000上运行的apache2。

这个想法是让访问者首先登录到子域apps.xxxx.xxx,其中包含所有公司应用程序的列表。单击一个,然后您将被重定向到其中一个应用程序,该应用程序还拥有自己的登录凭据,这些凭据将提供给潜在客户,以便在购买之前进行测试运行。 所有这些应用程序都需要从一个域运行,但从不同的路径运行。 例如。 apps.xxxx.xxx/app1 appps.xxxx.xxx/app2

在应用服务器上找到附加的我的nginx配置

server {
    listen 80 default_server;

    root /home/MY_NAME/myapp/public;

    index index.html index.htm index.php;

    server_name _;

    #location / {
    #    try_files $uri $uri/ /index.php$is_args$args;
    #}

    location ~ \.php$ {
       include snippets/fastcgi-php.conf;
       fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
    }

    location / {
        proxy_pass http://SAME_SERVER:8000;
        include proxy_params;
        #try_files $uri $uri/ /index.php$is_args$args;
    }

        location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

        sendfile off;

    client_max_body_size 100m;

        location ~ /\.ht {
                deny all;
    }

    location ~ /.well-known {
                allow all;
    }
}

0 个答案:

没有答案
相关问题