Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!