DOE DOE - 6 months ago 25
PHP Question

NGNIX server settings for laravel 5.2

I have developed a website in laravel and I want to install it on a local machine running nginx as a web server. Here is my config file

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root html;
index index.html index.php;

# Make site accessible from http://localhost/
server_name localhost;

location / {
root html;
index index.php;

location ~ .php$ {
root html;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME C:/nginx/html/$fastcgi_script_name;
include fastcgi_params;


When I browse http://localhost/mysite/ it runs C:/nginx/html/mysite/index.php

I want to execute C:/nginx/html/mysite/public/index.php file instead. How i can do that?


From your Nginx file I will assume your root directory for your project is html and all your Laravel files are in this directory.

If this is the case then you can either just go to http://localhost/mysite/public or alter your root directory in your Nginx configuration to html/public.

If that doesn't work, set root to the full path on your local machine to reach the public folder of your Laravel project.

Edit Try:

root /c/nginx/html/mysite/public


root C:/nginx/html/mysite/public