I want to run multiple laravel projects in nginx in window 10. I've run successfully single project. However I'm unable to run other projects in the localhost. Any help is appreciated. Thanks in advance.
The following works.
nginx.conf file
server {
listen 80;
server_name localhost;
location / {
root E:/web/nginx/html/project1/public;
try_files $uri $uri/ /index.php;
index index.php index.html index.htm;
location ~ \.php {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
}
But the following is not working
nginx.conf file
server {
listen 80;
server_name localhost;
location /project1 {
root E:/web/nginx/html/project1/public;
try_files $uri $uri/ /index.php;
index index.php index.html index.htm;
location ~ \.php {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
}
Here I've just added the name of the project (ie. project1 in the location but it gives 404 not found error. Similarly I want to run project2, project3 and so on.
Nginx error.log file
2021/12/15 16:09:30 [error] 12472#2028: *3 CreateFile() "E:\web\nginx/html/index.php" failed
(2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: "GET /project1/ HTTP/1.1", host: "localhost"