Some Issues with Configuration

Richard Ibbotson richard.ibbotson at gmail.com
Sat Mar 8 21:02:37 UTC 2014


> >>> http://wiki.nginx.org/WordPress<<
> > 
> > I'll have a read through this again.  The part that might work

Thanks to  Jonathan Matthews and Steve Holdoway for some helpful 
comments.  I've made some progress and probably a couple of steps 
backwards as well.  Bit more help could be useful.  NGINX version: 
1.4.5 (Ubuntu).  Looks like fastcgi is broken.  There isn't a fix for 
this until the back end of April.  PHP-FPM is working and so I'll have 
to use that.  

NGINX is serving up static HTML pages but I now find that WordPress 
pages are being served as plain text.  What I mean by that is that 
NGINX serves up this page....

"  <?php
/**
 * Front to the WordPress application. This file doesn't do anything, 
but loads
 * wp-blog-header.php which does and tells WordPress to load the 
theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' )  "

This doesn't look very healthy.  For that reason access is blocked 
just now.  For the WP installation which are blog / journalism / music 
I get the above text as a web page when I put the URL into a browser.  
Obviously this has to change so that the whole of a WP installation 
appears a web page.  What do I have to change to make this work 
properly ?  In /etc/nginx I can see ...

common  fastcgi_params.dpkg-dist  nginx.conf   nginx.conf.dpkg-dist    
sites-available  uwsgi_params.dpkg-dist conf.d  naxsi-ui.conf.1.4.1       
nginx.conf~  proxy_params.dpkg-dist  sites-enabled

I suppose that I have to configure some of these to correct tha above 
issue.  Not quite sure which ones.  In common there are locations.conf  
and  wpcommon.conf.  In conf.d there are blockips.conf  fastcgi.conf    
upstream.conf.  Can't think that fastcgi.conf is of any use to me.  In 
sites-available there are default.conf  default.dpkg-dist  
sleepypenguin.conf.  Not sure about these.  In sites-enabled there is 
default.conf  sleepypenguin.conf.  Not sure about those. 

My nginx.conf looks like this.....


user www-data;
pid /run/nginx.pid;
worker_processes  4;

events {
         worker_connections  1024;
}

http {
        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;

server {
        ## Your website name goes here.
        server_name slepypenguin.homelinux.org;
        ## Your only path reference.
        root /var/www/;
        ## This should be in your http block 
        index index.php;

        ##
        # Logging Settings
        # This may need updating if you are using awstats
        #
        ##

#    log_format  main  '$remote_addr - $remote_user [$time_local] 
#                      '$status $body_bytes_sent "$http_referer" '
#                      '"$http_user_agent" "$http_x_forwarded_for"';

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

    gzip  on;
        gzip_disable "msie6";

        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_types text/plain text/css application/json application/x-
javascript text/xml application/xml application/xml+rss 
text/javascript;

        location = /favicon.ico {
                log_not_found off;
                access_log off;   
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;   
        }

        location / {
                # This is cool because no php is touched for static
                # include the "?$args" part so non-default permalinks 
doesn't break when using query string
                try_files $uri $uri/ /index.php?$args;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }

        ##
        # nginx-naxsi config
        # Uncomment it if you installed nginx-naxsi
        ##

        #include /etc/nginx/naxsi_core.rules;

        ##
        # Virtual Hosts Config
        ##
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*.conf;
   }
}



-- 
Richard



More information about the nginx mailing list