tomak707
tomak707

When I install OctoberCMS on my local nginx server, the front-end doesn't open properly. It seems to lack CSS and JS. On back-end I get a 500 server error. For some reason, my server logging doesn't record anything, so I'm not able to debug it on my own. Anybody has an idea what could go wrong?

tomak707
tomak707

Sorry for false alarm, I've managed to solve this on my own. I had this piece of code in my config file:

server {
    ...
    location / {
        root /media/AMPP/nginx-root/projects/october/http;
        # First attempt to serve request as file, then
        # as directory, then fall back to index.html
        try_files $uri $uri/ /index.html;
    }
    ...
}

I've changed it to:

server {
    ...
    location / {
        root /media/AMPP/nginx-root/projects/october/http;

        # First attempt to serve request as file, then
        # as directory, then fall back to index.php
        try_files $uri $uri/ /index.php;
    }
    ...
}

and everything works now.

nathan.stiz899
nathan.stiz899

This doesnt work for me, please can you post your entire configuration file ?

tomak707
tomak707

Sure thing, here's the complete config file:

server {
    listen   80;

    server_name october.dev;

    index index.php index.html index.htm;

    access_log /media/AMPP/nginx-root/projects/october/logs/access_log;
    error_log /media/AMPP/nginx-root/projects/october/logs/error_log;

    location / {
        root /media/AMPP/nginx-root/projects/october/http;

        # First attempt to serve request as file, then
        # as directory, then fall back to index.php
        try_files $uri $uri/ /index.php;
    }

    location ~ \.php$ {
        include fastcgi_params;

        root /media/AMPP/nginx-root/projects/october/http;

        try_files  $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
    }
}
nathan.stiz899
nathan.stiz899

Thank you, it's working fine.

amauri.worktek7938
amauri.worktek7938

where is this file?

ctrlaltdylan
ctrlaltdylan

amauri.worktek7938 said:

where is this file?

This is an nginx config file, they are located in /etc/nginx/sites-available and /etc/nginx/sites-enabled

lubos.len21112
lubos.len21112

Not working here but I have the same problem

enok
enok

Just incase anyone has encountered this issue with www not properly loading css in Nginx I've had this issue where Nginx wouldn't load the www version of my site, it would return a 404. So after search hours online, I found my fix: https://www.digitalocean.com/community/questions/adding-www-to-my-domain-at-nginx-server

by simply adding the www.mydomain.com to the current site-enabled configuration

server {
 listen 80;
 server_name mydomain.com www.mydomain.com;
...

It finally worked!! loaded my css and images etc...

Last updated

JanBo
JanBo

And don't forget to adapt the try_files directive :

try_files $uri $uri/ /index.php$is_args$args;
without it, I couldn't search plugins in the backend.

Last updated

1-10 of 10