This is one of the problems that I encountered when migrating your laravel folder to nginx configured server.
1. edit your nginx default config.
vi /etc/nginx/sites-available/default
2. My nginx configuration without any modification.
server {
listen 80;
server_name localhost;
root /var/www/html/laravel/public;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
location /phpmyadmin {
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
3. Modified version of my nginx configuration.
server {
listen 80;
server_name localhost;
root /var/www/html/laravel/public;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
location /phpmyadmin {
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
4. Restart nginx.
5. Check the browser to see the changes.
No comments:
Post a Comment