Title: Nginx issues
Last modified: March 17, 2017

---

# Nginx issues

 *  Resolved [SHiRKiT](https://wordpress.org/support/users/shirkit/)
 * (@shirkit)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/nginx-issues-2/)
 * Ok here I come again,
 * I had given up on NGinx on my other server, but now I need to use it, no matter
   what. But I just can’t get it to work under NGnix.
 * – I’ve created the ‘cache’ folder and given ‘chmod 777’
    – I’ve added the rewrite
   rule but it returns 404 for the images
 * I’m stuck getting 404, probably due to some silly mistake by me.
 * The website is currently hosted at [HERE](https://orquidariobahia.com.br/wordpress)
 * So here’s what I got:
 *     ```
       ✔ PHP GD library is installed.
       ✖ Image cache directory has not been created.
       But this is probably because the cache has not been accessed yet. 
       After accessing your website from a mobile device the directory should be automatically created.
   
       /data/wwwroot/orquidariobahia.com.br/wordpress/wp-content/cache => drwxrwxrwx
       ✔ Installation .htaccess file is setup OK.
       /data/wwwroot/orquidariobahia.com.br/wordpress/.htaccess => -rw-r--r--
       ❖ Adaptive images settings dump:
       array(12) {
         ["resolutions"]=>
         array(6) {
           [0]=>
           int(1900)
           [1]=>
           int(1400)
           [2]=>
           int(1200)
           [3]=>
           int(1024)
           [4]=>
           int(640)
           [5]=>
           int(480)
         }
         ["landscape"]=>
         bool(true)
         ["hidpi"]=>
         bool(true)
         ["cache-directory"]=>
         string(21) "cache/adaptive-images"
         ["watched-directories"]=>
         array(2) {
           [0]=>
           string(18) "wp-content/uploads"
           [1]=>
           string(17) "wp-content/themes"
         }
         ["jpeg-quality"]=>
         int(75)
         ["sharpen-images"]=>
         bool(true)
         ["watch-cache"]=>
         bool(true)
         ["browser-cache"]=>
         float(180)
         ["cdn-support"]=>
         bool(false)
         ["version"]=>
         string(6) "0.6.61"
         ["sanitized"]=>
         bool(true)
       }
       ```
   
 *     ```
       Web Server	
       nginx/1.10.3
       Document Root	
       /data/wwwroot/orquidariobahia.com.br
       PHP	
       7.1.3
       PHP Time Limit	
       0
       PHP Memory Limit	
       256M
       PHP Post Max Size	
       100M
       PHP Upload Max Size	
       50M
       PHP Max Input Vars	
       1000
       PHP Display Errors	
       No
       PHP Error Log	
       MySQL	
       5.5.5-10.1.22-MariaDB
       MySQL Ext/mysqli	
       Yes
       MySQL Table Prefix	
       wp_
       MySQL DB Charset	
       utf8mb4
       WP	
       4.7.3
       WP Multisite	
       No
       WP Debug Mode	
       No
       WP Site url	
       https://orquidariobahia.com.br/wordpress
       WP WP Home url	
       https://orquidariobahia.com.br/wordpress
       WP Permalinks	
       /%postname%/
       WP home path	
       /data/wwwroot/orquidariobahia.com.br/wordpress/
       WP content dir	
       /data/wwwroot/orquidariobahia.com.br/wordpress/wp-content
       WP plugin dir	
       /data/wwwroot/orquidariobahia.com.br/wordpress/wp-content/plugins
       WP content url	
       https://orquidariobahia.com.br/wordpress/wp-content
       WP plugin url	
       https://orquidariobahia.com.br/wordpress/wp-content/plugins
       WP Locale	
       pt_BR
       WP Memory Limit	
       40M
       WP Max Upload Size	
       50mb
       WP Active plugins	
       Adaptive Images for WordPress v.0.6.61 by Nevma
       Advanced WordPress Reset v.1.0.1 by Younes JFR.
       All-in-One WP Migration v.6.42 by ServMask
       Debug Bar v.0.8.4 by wordpressdotorg
       Desativar Comentários v.1.6 by Samir Shah
       Loco Translate v.2.0.12 by Tim Whitlock
       Make Filename Lowercase v.1.0.2 by Ed Reckers (Red Bridge Internet)
       Regenerate Thumbnails v.2.2.6 by Alex Mills (Viper007Bond)
       Registrations for WooCommerce v.1.0.6 by Haste - design and technology, Allyson Souza, Anyssa Ferreira
       Slider Revolution v.5.3.0.2 by ThemePunch
       SVG Support v.2.3.6 by Benbodhi
       Velvet Blues Update URLs v.3.2.7 by VelvetBlues.com
       WooCommerce PagSeguro v.2.11.5 by Claudio Sanches
       WooCommerce v.2.6.14 by WooThemes
       Importador do WordPress v.0.6.3 by wordpressdotorg
       ZNPB Counter Element v.1.0.1 by Balasa Sorin Stefan
       WP MU plugins	
       ```
   
 * cat nginx/conf/vhost/orquidariobahia.com.br.conf
 *     ```
       server {
         listen 80;
         listen 443 ssl http2;
         ssl_certificate /usr/local/nginx/conf/ssl/orquidariobahia.com.br.crt;
         ssl_certificate_key /usr/local/nginx/conf/ssl/orquidariobahia.com.br.key;
         ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
         ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
         ssl_prefer_server_ciphers on;
         ssl_session_timeout 10m;
         ssl_session_cache builtin:1000 shared:SSL:10m;
         ssl_buffer_size 1400;
         add_header Strict-Transport-Security max-age=15768000;
         ssl_stapling on;
         ssl_stapling_verify on;
         server_name orquidariobahia.com.br;
         access_log /data/wwwlogs/orquidariobahia.com.br_nginx.log combined;
         index index.html index.htm index.php;
         include /usr/local/nginx/conf/rewrite/wordpress.conf;
         root /data/wwwroot/orquidariobahia.com.br;
         if ($ssl_protocol = "") { return 301 https://$server_name$request_uri; }
   
         #error_page 404 = /404.html;
         #error_page 502 = /502.html;
   
         location ~ [^/]\.php(/|$) {
           #fastcgi_pass remote_php_ip:9000;
           fastcgi_pass unix:/dev/shm/php-cgi.sock;
           fastcgi_index index.php;
           include fastcgi.conf;
         }
         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
           expires 30d;
           access_log on;
           rewrite_log on;
           rewrite \.(?:jpe?g|gif|png)$ wp-content/plugins/adaptive-images/adaptive-images-script.php;
         }
         location ~ .*\.(js|css)?$ {
           expires 7d;
           access_log off;
         }
         location ~ /\.ht {
           deny all;
         }
       }
       ```
   
 * cat nginx/conf/fastcgi.conf
 *     ```
       fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
       fastcgi_param  QUERY_STRING       $query_string;
       fastcgi_param  REQUEST_METHOD     $request_method;
       fastcgi_param  CONTENT_TYPE       $content_type;
       fastcgi_param  CONTENT_LENGTH     $content_length;
   
       fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
       fastcgi_param  REQUEST_URI        $request_uri;
       fastcgi_param  DOCUMENT_URI       $document_uri;
       fastcgi_param  DOCUMENT_ROOT      $document_root;
       fastcgi_param  SERVER_PROTOCOL    $server_protocol;
       fastcgi_param  REQUEST_SCHEME     $scheme;
       fastcgi_param  HTTPS              $https if_not_empty;
   
       fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
       fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
   
       fastcgi_param  REMOTE_ADDR        $remote_addr;
       fastcgi_param  REMOTE_PORT        $remote_port;
       fastcgi_param  SERVER_ADDR        $server_addr;
       fastcgi_param  SERVER_PORT        $server_port;
       fastcgi_param  SERVER_NAME        $server_name;
   
       # PHP only, required if PHP was built with --enable-force-cgi-redirect
       fastcgi_param  REDIRECT_STATUS    200;
       ```
   
 * cat nginx/conf/nginx.conf
 *     ```
       user www www;
       worker_processes auto;
   
       error_log /data/wwwlogs/error_nginx.log crit;
       pid /var/run/nginx.pid;
       worker_rlimit_nofile 51200;
   
       events {
         use epoll;
         worker_connections 51200;
         multi_accept on;
       }
   
       http {
         include mime.types;
         default_type application/octet-stream;
         server_names_hash_bucket_size 128;
         client_header_buffer_size 32k;
         large_client_header_buffers 4 32k;
         client_max_body_size 1024m;
         client_body_buffer_size 10m;
         sendfile on;
         tcp_nopush on;
         keepalive_timeout 120;
         server_tokens off;
         tcp_nodelay on;
   
         fastcgi_connect_timeout 300;
         fastcgi_send_timeout 300;
         fastcgi_read_timeout 300;
         fastcgi_buffer_size 64k;
         fastcgi_buffers 4 64k;
         fastcgi_busy_buffers_size 128k;
         fastcgi_temp_file_write_size 128k;
         fastcgi_intercept_errors on;
   
         #Gzip Compression
         gzip on;
         gzip_buffers 16 8k;
         gzip_comp_level 6;
         gzip_http_version 1.1;
         gzip_min_length 256;
         gzip_proxied any;
         gzip_vary on;
         gzip_types
           text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
           text/javascript application/javascript application/x-javascript
           text/x-json application/json application/x-web-app-manifest+json
           text/css text/plain text/x-component
           font/opentype application/x-font-ttf application/vnd.ms-fontobject
           image/x-icon;
         gzip_disable "MSIE [1-6]\.(?!.*SV1)";
   
         #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.
         open_file_cache max=1000 inactive=20s;
         open_file_cache_valid 30s;
         open_file_cache_min_uses 2;
         open_file_cache_errors on;
   
       ######################## default ############################
         server {
         listen 80;
         server_name _;
         access_log /data/wwwlogs/access_nginx.log combined;
         root /data/wwwroot/default;
         index index.html index.htm index.php;
         location /nginx_status {
           stub_status on;
           access_log off;
           allow 127.0.0.1;
           deny all;
           }
         location ~ [^/]\.php(/|$) {
           #fastcgi_pass remote_php_ip:9000;
           fastcgi_pass unix:/dev/shm/php-cgi.sock;
           fastcgi_index index.php;
           include fastcgi.conf;
           }
         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
           expires 30d;
           access_log off;
           }
         location ~ .*\.(js|css)?$ {
           expires 7d;
           access_log off;
           }
         location ~ /\.ht {
           deny all;
           }
         }
   
       ########################## vhost #############################
         include vhost/*.conf;
       }
       ```
   
 * cat nginx/conf/rewrite/wordpress.conf
 *     ```
       location / {
           try_files $uri $uri/ /index.php?$args;
           }
       rewrite /wp-admin$ $scheme://$host$uri/ permanent;
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [SHiRKiT](https://wordpress.org/support/users/shirkit/)
 * (@shirkit)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/nginx-issues-2/#post-8924038)
 * Sorry but I can’t edit my post. The rewrite rule in located under the code section
   _cat nginx/conf/vhost/orquidariobahia.com.br.conf_ in _location ~ .*\.(gif|jpg
   |jpeg|png|bmp|swf|flv|mp4|ico)$ {_
 *  Thread Starter [SHiRKiT](https://wordpress.org/support/users/shirkit/)
 * (@shirkit)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/nginx-issues-2/#post-8926404)
 * Close this, double post
 *  Plugin Author [Takis Bouyouris](https://wordpress.org/support/users/nevma/)
 * (@nevma)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/nginx-issues-2/#post-8926509)
 * Oh, so have you found a solution to your problem after all?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Nginx issues’ is closed to new replies.

 * ![](https://ps.w.org/adaptive-images/assets/icon-256x256.png?rev=1138642)
 * [Adaptive Images for WordPress](https://wordpress.org/plugins/adaptive-images/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/adaptive-images/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/adaptive-images/)
 * [Active Topics](https://wordpress.org/support/plugin/adaptive-images/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/adaptive-images/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/adaptive-images/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Takis Bouyouris](https://wordpress.org/support/users/nevma/)
 * Last activity: [9 years, 2 months ago](https://wordpress.org/support/topic/nginx-issues-2/#post-8926509)
 * Status: resolved