Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

112
Visualizações
Laravel Subdomain with Landing Page and Sub projects inside

I'm trying to create a landing page with links to php websites demo like the following :

https://demos.infinitywebservices.tn/ : landing page

https://demos.infinitywebservices.tn/demo1/public : takes to demo1 app 
https://demos.infinitywebservices.tn/demo2/public : takes to demo2 app 

... and so on

I'm using Nginx on Debian 9 Server

My /etc/nginx/sites-available/infinitywebservices.conf

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    root /var/www/tony-projects/infinitywebservices/demos;
    index index.php index.html index.htm;

    server_name demos.infinitywebservices.tn  www.demos.infinitywebservices.tn;

    gzip on;
    gzip_vary on;
    gzip_disable "msie6";
    gzip_comp_level 6;
    gzip_min_length 1100;
    gzip_buffers 16 8k;
    gzip_proxied any;
    gzip_types
    text/plain
    text/css
    text/js
    text/xml
    text/javascript
    application/javascript
    application/x-javascript
    application/json
    application/xml
    application/xml+rss;     

    location / {
        try_files $uri $uri/ =404;
    }

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

    location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|svg|woff|woff2|ttf)\$ {
                expires 1M;
                access_log off;
                add_header Cache-Control "public";
    }

    location ~* \.(?:css|js)\$ {
                expires 7d;
                access_log off;
                add_header Cache-Control "public";
    }

    ssl_certificate /...; # managed by Certbot
    ssl_certificate_key /...; # managed by Certbot
}

My Directories structures

/var/www
      |__tony-projects
               |__infinitywebservices
                           |__demos
                                |__ index.php (Landing page for demos.infinitywebservices.tn/)
                                |__ demo1 (Laravel Project)
                                |__ demo2 ...
                                |
                                |..... 

P.S

  1. I'm currently using default .htaccess config under demo1 and demo2 Laravel Projects
  2. For now only home page works for me when trying to visit a sub project like https://demos.infinitywebservices.tn/demo1/public/ (See : https://demos.infinitywebservices.tn/laravel-test/public)

  3. However for https://demos.infinitywebservices.tn/laravel-test/public/test (Route test exists) , i'm getting 404 Not Found nginx/1.10.3

What i'm missing here ?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Instead of responding with a 404 status, you need to pass all unknown URIs to the application's controller (e.g. /laravel-test/public/index.php).

If you have multiple apps with a well defined directory structure, you will probably want to use a regular expression to extract the name of the application (e.g. laravel-test) so that the correct controller is used.

For example:

location / {
    try_files $uri $uri/ @rewrite;
}
location @rewrite {
    rewrite ^(/[^/]+/public) $1/index.php last;
}
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda