Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

120
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda