Operating system: ubuntu13.10
Server: nginx 1.6
Configure nginx to access different directories according to different URL points
Use location/directory name { ... } to access different directories
But I want to build laravel4 framework, and I want to parse /coolwifi/test directly into /coolwifi/public/index.php/test, but an error will be reported:
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
But access through http://localhost/coolwifi/public/index.php/test is possible
what should I do?
The default configuration file is as follows:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /home/kimhwawoon/nginx;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location /coolwifi/ {
index index.php;
#if (!-e $request_filename) {
# rewrite ^/(.*)$ /public/index.php? last;
# break;
#}
try_files $uri $uri/ /coolwifi/public/index.php?$args;
}
location /phpmyadmin/ {
index index.php
try_files $uri $uri/ /phpmyadmin/index.php?$args;
}
location /swagger/ {
index index.html index.php;
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
No matter how to set up a single server, the problem can be solved by setting up multiple servers, and configure multiple domain names in /etc/hosts of the local machine to point to the local, and use different domain names to distinguish different directories
Have you ever used phalcon? I recently learned about phalcon, but according to your settings, all routes are redirected to index/index. Do you have a solution? Thank you