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

337
Views
nginx local redirect from /var/www/html/index.html to /var/www/html/larvel_project/public

we are working on a local WIFI project where we use internet-enabled Ubuntu server inside CPU and we don't have any domain name to point it. We provide wifi access from the CPU server so that anyone can access it within our local premises.

For captive portal working, we need to have generate_204 folder inside the following

/var/www/html/generate_204/

from here we redirect to index.php which is at the same level of generate_204 folder as following

/var/www/html/index.php

from here I want to redirect to my Laravel project folder which resides inside the same level as following

/var/www/html/laravel_project/public/

The overall structure is as follows

/var/www/html/
            index.php
            generate_204/
                        index.php
            laravel_project/
                           public/
                                 index.php

How can I achieve redirection from /var/www/html/index.php to /var/www/html/laravel_project/public/

Following is my current NGINX setup:

server {
    listen 80 default_server;
        root /var/www/html;
        index index.php index.html;
    server_name _;
    add_header Access-Control-Allow-Origin *;
        location / {
        try_files $uri $uri/ =404;
        }

        location ~ \.php$ {
        include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }


        location ~ /\.ht {
                deny all;
        }
}

The above NGINX setup works fine when we had a plain PHP project and we were redirecting.

Any help really appreciated.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I dont think there is a need to redirect to your laravel folder. Just change the line root /var/www/html; to root /var/www/html/laravel_project/public;

also i have

location / {
    try_files $uri $uri/ /index.php?$query_string;
}
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!