This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I have an existing website that uses laravel 4.2. I am attempting to install October CMS in the /blog subdirectory (to function as a blog and help section only), but something in nginx setup incorrectly. I did the October CMS install wizard, and am able to get the /blog/index.php page to appear correctly. The issue is when I attempt to login to the backend (/blog/backend), I get a 404 page. Below is my virtual-host nginx configuration for this site:
server {
listen 80;
server_name my_site;
root /home/vagrant/my_site/public;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/my_site.app-error.log error;
rewrite_log on;
error_page 404 /index.php;
sendfile off;
# October CMS rewrites
location blog {
root /home/vagrant/my_site/public/blog;
try_files $uri $uri/ /index.php$is_args$args;
}
rewrite ^/blog/themes/.*/(layouts|pages|partials)/.*.htm /blog/index.php break;
rewrite ^/blog/bootstrap/.* /blog/index.php break;
rewrite ^/blog/config/.* /blog/index.php break;
rewrite ^/blog/vendor/.* /blog/index.php break;
rewrite ^/blog/storage/cms/.* /blog/index.php break;
rewrite ^/blog/storage/logs/.* /blog/index.php break;
rewrite ^/blog/storage/framework/.* /blog/index.php break;
rewrite ^/blog/storage/temp/protected/.* /blog/index.php break;
rewrite ^/blog/storage/app/uploads/protected/.* /blog/index.php break;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 300s;
fastcgi_send_timeout 120;
fastcgi_read_timeout 120;
}
location ~ /\.ht {
deny all;
}
}
I can get the /blog/backend page to appear (albeit unstyled with css/js) if I add the following directive:
rewrite ^/blog /blog/index.php break;
Note that with the above rewrite directive, the assets for the /blog/index.php page do come back with a result of 404, so the /blog/index.php page is unstyled as well. However, if I remove the above directive, the links will work again.
I am new to nginx and setting up October CMS and cannot figure this out. Thank you!
You could try location /blog
as the standard location is /
.
Not an expert myself though...
This fixed it for me:
pico /etc/nginx/sites-enabled/default
And changing whatever was in the location block to:
location / {
try_files $uri $uri/ /index.php?$query_string;
location ~* \.php$ {
try_files $uri /index.php =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
include fastcgi_params;
}
}
1-3 of 3