Kalabox Nginx config

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by jpstrikesback on March 11, 2013 at 2:44am

Has anyone played with the Kalabox VM from:

http://kalabox.kalamuna.com/

?

I am having no luck getting image styles to function. Images at style paths are returning:

"Error generating image."

Permissions are fine (according to drupal when saving settings at the file system settings)

I've tried a few of the following:

location ~ ^/sites/.*/files/styles/ {
try_files $uri @cleanurl;
}

location ~ ^/sites/.*/files/styles/ {
access_log off;
expires 45d;
error_page 404 @cleanurl;
}

the full config (without those items) is as follows:

server
{
server_name something-com.kala;
root /var/www/something-com;

client_max_body_size 100M;
fastcgi_read_timeout 1800;

index index.php;

# No reading git files
location ~ /.git {
autoindex on;
}

# Protect /private (for private code)
location ~ ^/private/ {
return 403;
}

# Protect /sites/default/files/private (for private files)
location ~ ^/sites/default/files/private/ {
return 403;
}

# Protect /sites/default/config (for configuration)
location ~ ^/sites/default/config/ {
return 403;
}

location / {
try_files $uri $uri/ @cleanurl;
}

location @cleanurl {
rewrite ^/(.*)$ /index.php?q=1ドル last;
}

location ~ .php$ {
try_files $uri =404;

include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/tmp/php-fpm.sock;
}

location ~ /.ht {
deny all;
}
}

Cheers!
JP

Comments

I'm not sure what the

Posted by bhosmer on March 11, 2013 at 5:37pm

I'm not sure what the @cleanurl is referencing, but here is a working NGINX configuration that I finished up this weekend:

https://gist.github.com/benhosmer/5118626

I pieced it together from various documentation resources around the web, and just kept trying until everything worked like I wanted it.

I'm using spawn-fcgi instead of php-fpm, but other than that, the other directives should translate over for you.

Likely the temporary

Posted by andrew_mallis on March 13, 2013 at 7:57am

Likely the temporary directories have permission issues here.

you might need to

kala@kalabox:find . -type d -exec chmod u=rwx,g=rx,o= '{}' \;
kala@kalabox:find . -type f -exec chmod u=rw,g=r,o= '{}' \;
kala@kalabox:chmod go+w sites/default/files

also visit /admin/config/media/file-system and save the form there or, in settings.php define the tmp and files directories:

$conf['file_temporary_path'] = '/tmp';
$conf['file_public_path'] = 'sites/default/files';
$conf['file_private_path'] = 'sites/default/files/private';

We are working on smoothing this out; congratulations on discovering this nugget of greatness before its time. Stay tuned for the real deal.

It is a nugget of

Posted by jpstrikesback on March 14, 2013 at 4:00pm

It is a nugget of greatness!!

Thanks so much for the reply here (My office is currently experiencing issues connecting to d.o. so that's why the late reply from me...)

This unfortunately didn't do the trick, if you have any other ideas please do tell :) I tried to contact via the kalamuna site contact form but a nice growlesque message popped up saying that SMTP wasn't up for sending my mail and would rather nap or something like that. If I can join any formal beta, I'd love to.

Cheers,
JP

BTW, loving the new version!

Posted by jpstrikesback on April 17, 2013 at 1:26am

BTW, loving the new version!

Why spread a bad config

Posted by perusio on March 13, 2013 at 1:48pm

Like it has been more or less exhaustively debated here. The config shown on the Nginx wiki is insecure and does things which are not necessary, like the gratuitous rewrites.

Please use one of the configs indicated on the group intro and not that one. There's a reason why it's not recommended there.

Help stop spreading bad Nginx configs. There already too many out there. Thanks.

Which bad config are you

Posted by bhosmer on March 13, 2013 at 3:01pm

Which bad config are you referring to?

the one

Posted by perusio on March 13, 2013 at 3:06pm

that starts the thread.

Yours

Posted by perusio on March 13, 2013 at 3:11pm

is no better. Look at the way you do the server rewrite. Furthermore it uses PATH_INFO which is not required by Drupal, which potentially opens a vulnerability if you forget to set the PHP runtime config properly.

I assume you are referring

Posted by bhosmer on March 13, 2013 at 3:17pm

I assume you are referring the config that I posted.

I appreciate the criticism. I came across your configs, but as a newcomer to NGINX, I found them very complete, but also somewhat difficult to understand. I never could get my site working using yours.

I think what I needed, and a lot of others need, is a simple, somewhat easy to understand configuration to base everything off of.

A lot of users are most likely coming from an Apache world, which adds to a lot of the confusion.

If you have a chance, I'd welcome any corrections to the one I am using. Admittedly, I am definitely not an expert and only posted mine to help the OP.

I agree, while I could get it

Posted by vegardx on March 15, 2013 at 8:06pm

I agree, while I could get it working, I think it lacks of documentation to why things are done as they are. Maybe you (perusio) could update the Nginx wiki with some pointers to why "XYZ" is bad, and what should be considered instead, just to get a basic page up and running.

--
Vegard

Local dev only

Posted by jpstrikesback on March 14, 2013 at 7:11pm

Hey Perusio,

This config is from a VM meant for local dev only...not spreading it as a best practice or anything, just asking questions, and I too appreciate knowing that it is insecure for real use!

Cheers,
JP

Nginx

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /