Showing posts with label nginx. Show all posts
Showing posts with label nginx. Show all posts

Jul 18, 2016

wordpress cross-origin request blocked

Your web fonts can get really messed up if you don't properly define nginx to handle CORS.

This is the block I've included in my sites-enabled settings to take care of that:

location ~* \.(eot|ttf|woff|woff2)$ {
    add_header Access-Control-Allow-Origin *;
}
Source: How do I add access control allow origin in nginx

Jul 14, 2016

413 Request Entity Too Large Nginx

railscapistrano-413-request-entity-too-large-nginx-wordpress-error


Let's go straight to the point. You need to modify max file size settings at two locations: php.ini and nginx.conf

For php.ini:
1) Open php.ini: vi /etc/php5/fpm/php.ini
2) Find upload_max_filesize = 2M
3) Change to upload_max_filesize = 32M (or larger)
4) Save and close php.ini
5) Restart services: sudo service php5-fpm restart


For nginx.conf:
1) Open nginx.conf: vi /etc/nginx/nginx.conf
2) Add this line if you cannot find it in the "http", "server" or "location" block: client_max_body_size ;
3) Modify it to 32M (or whatever size you set  in php.ini) like this: client_max_body_size 32M;
4) Restart nginx: sudo service nginx restart

Jul 12, 2016

wordpress permalinks 404 nginx

You're ready to blog.

Your head is full of ideas, words.

You've decided on this awesome (everybody says so, at least) CMS called "Wordpress".

You installed mysql in under 3 minutes flat.

Then you decided Apache web server is for dinosaurs. You're going to use something way cooler called "nginx".

You finally got everything installed and fire up wordpress in the browser.

You log in, you see your blog. Hurray! You're just like the experts.

Then you click on  a link, any link, they all give you an ugly 404 page. What the heck?

This is how I solved it:

location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
}

Go to your `/etc/nginx/sites-enabled/sitename` file and paste that line in the `location /` block

Done.