Wordpress Multisite get an 502

Discussion in 'Installation/Configuration' started by cyprus, Apr 23, 2012.

  1. cyprus

    cyprus New Member

    Hello last week I got ISPConfig to run after 2 weeks of hard work.
    I resolved each task to get ISPcontig running on my server but the main point why I even thought about to switch my configuration is still not accomplished.

    Before I start to describe the Problem here is my server config.
    Debian Squeeze, Nginx , php-fpm, Postfix / Dovecot ,MySQL 5.5

    Most stuff is fine ISPconfig seems to work like it should be. Postfix / Dovecot works as well.

    I´ve uploaded a Flash Site to one of my webs and it works

    I tried to move one of my Wordpress ms installation from an Apache environment, and this fails.
    I know I can´t use the Apache .htaccess rules anymore and have to tell nginx what to do. I took the Nginx Config from the wordpress.org codex.
    http://codex.wordpress.org/Nginx

    The configuration is clear in most cases but there is one point which is not clear
    I implemented it as described but if I call a site I get an 502 Error.
    I get an invalid request from the Upstream Server.
    And now I´m a littlebit lost. And need your inspiration to solve the problem.

    Thank you in advance.
    Cyprus
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The nginx configuration for php is done by ispconfig, so you should not duplicate this with your manual configuration or nginx will fail. The guide you followed is for a complete nginx configuration for servers without a controlpanel thats uses different paths etc., if you use a controlpanel like ispconfig, then dont touch nginx.conf file or site configuration file. Instaed you just add the wordpress rules in the custom nginx directives field in ispconfig.
     
  3. cyprus

    cyprus New Member

    I read about such field but where should this be?

    Thank you for your reply
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Options tab of the website settings.
     
  5. cyprus

    cyprus New Member

    Okay thank you I found it.

    But there are a few questions remaining.
    1) Do you recommend to turn " Use Socket for PHP-FPM" on?
    2) Do you agree that I only have to drop the rewrite rules for Nginx into the Nginx topic

    Thanx in advance
    Cyprus
     
  6. cyprus

    cyprus New Member

    So I deleted everything I´ve changed in the nginx.conf and orx.org vhost config and dropped the rewrite rule I posted above without the part for the caching plugin into nginx configuration in the ispconfig backend and the result is a 500 Error.
    Not shure what to check next.
     
  7. cyprus

    cyprus New Member

    While I´m trying to solve this issue. I had a look at my ispconfig backend and I ask myself whether I missed something in the configuration cause. In the row IP-Address there is no Ip to choose theres is just a star. Could this cause my error and how can I solve it.

    Thanx in advance
    Cyprus
     
  8. cyprus

    cyprus New Member

    Okay I fixed my mistake. Start all over again. And it works to load the site and get into the backend. At this moment I´ve changed nothing in the options tab.
    But I got still stucked, cause I don´t know what to implement in the options tab and what will be solved by ispconfig.
    Can anybody provide a working rewrite rule. Or give me a hint what ispconfig does and what not?

    Thanx in advance
    Cyprus
     
  9. falko

    falko Super Moderator ISPConfig Developer

    This is what I use in the nginx Directives field on the Options tab in ISPConfig for a Wordpress site (with the W3 Total Cache plugin):

    Code:
           location / {
                    try_files $uri $uri/ /index.php?$args;
           }
    
           # Add trailing slash to */wp-admin requests.
           rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    
           location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
                    expires max;
                    log_not_found off;
           }
    
           include /var/www/mysite.de/web/nginx.conf;
    
           location ~ /nginx.conf {
                    deny all;
                    access_log off;
                    log_not_found off;
           }
    /var/www/mysite.de/web/nginx.conf contains:

    Code:
    # BEGIN W3TC Page Cache cache
    location ~ /wp-content/w3tc/pgcache.*html$ {
        add_header X-Powered-By "W3 Total Cache/0.9.2.4";
        add_header Vary "Accept-Encoding, Cookie";
    }
    location ~ /wp-content/w3tc/pgcache.*gzip$ {
        gzip off;
        types {}
        default_type text/html;
        add_header X-Powered-By "W3 Total Cache/0.9.2.4";
        add_header Vary "Accept-Encoding, Cookie";
        add_header Content-Encoding gzip;
    }
    # END W3TC Page Cache cache
    # BEGIN W3TC Browser Cache
    gzip on;
    gzip_types text/css application/x-javascript text/x-component text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
    location ~ \.(css|js|htc)$ {
        add_header X-Powered-By "W3 Total Cache/0.9.2.4";
    }
    location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ {
        add_header X-Powered-By "W3 Total Cache/0.9.2.4";
    }
    location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
        add_header X-Powered-By "W3 Total Cache/0.9.2.4";
    }
    # END W3TC Browser Cache
    # BEGIN W3TC Page Cache core
    rewrite ^(.*\/)?w3tc_rewrite_test$ $1?w3tc_rewrite_test=1 last;
    set $w3tc_rewrite 1;
    if ($request_method = POST) {
        set $w3tc_rewrite 0;
    }
    if ($query_string != "") {
        set $w3tc_rewrite 0;
    }
    if ($http_host != "mysite.de") {
        set $w3tc_rewrite 0;
    }
    set $w3tc_rewrite2 1;
    if ($request_uri !~ \/$) {
        set $w3tc_rewrite2 0;
    }
    if ($request_uri ~* "(sitemap(_index)?\.xml(\.gz)?|[a-z0-9_\-]+-sitemap([0-9]+)?\.xml(\.gz)?)") {
        set $w3tc_rewrite2 1;
    }
    if ($w3tc_rewrite2 != 1) {
        set $w3tc_rewrite 0;
    }
    set $w3tc_rewrite3 1;
    if ($request_uri ~* "(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|\/feed\/|wp-.*\.php|index\.php)") {
        set $w3tc_rewrite3 0;
    }
    if ($request_uri ~* "(wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php)") {
        set $w3tc_rewrite3 1;
    }
    if ($w3tc_rewrite3 != 1) {
        set $w3tc_rewrite 0;
    }
    if ($http_cookie ~* "(comment_author|wp\-postpass|wordpress_\[a\-f0\-9\]\+|wordpress_logged_in)") {
        set $w3tc_rewrite 0;
    }
    if ($http_user_agent ~* "(W3\ Total\ Cache/0\.9\.2\.4)") {
        set $w3tc_rewrite 0;
    }
    set $w3tc_ua "";
    set $w3tc_ref "";
    set $w3tc_ssl "";
    set $w3tc_enc "";
    if ($http_accept_encoding ~ gzip) {
        set $w3tc_enc _gzip;
    }
    set $w3tc_ext "";
    if (-f "$document_root/wp-content/w3tc/pgcache/$request_uri/_index$w3tc_ua$w3tc_ref$w3tc_ssl.html$w3tc_enc") {
        set $w3tc_ext .html;
    }
    if ($w3tc_ext = "") {
      set $w3tc_rewrite 0;
    }
    if ($w3tc_rewrite = 1) {
        rewrite .* "/wp-content/w3tc/pgcache/$request_uri/_index$w3tc_ua$w3tc_ref$w3tc_ssl$w3tc_ext$w3tc_enc" last;
    }
    # END W3TC Page Cache core
    This is based on the following tutorial: http://www.howtoforge.com/running-wordpress-on-nginx-lemp-on-debian-squeeze-ubuntu-11.04
     
  10. cyprus

    cyprus New Member

    Thank you falko for sharing your entries.
    These may be fine on a single wordpress installation but didn´t help in a multisite environment.

    This has done the job for me:
    BUT there´s a big BUT! I still have errors on sites which have an different theme than the main twenty11. For my these sites I´m still getting an 502 and 500 Error. Which is not acceptable.
    My question is, are there any suggestions what to do?
    And I´m a little bit frustrated about nginx, is the a way back to apache whithout starting all over?

    Thanx for your support Cyprus
     
  11. cyprus

    cyprus New Member

    I think I found my bug
    After vi /etc/php5/cgi/php.ini
    uncomment
    cgi.fix_pathinfo=1

    It seems to work.

    Thanks for the support

    Cyprus
     
  12. cyprus

    cyprus New Member

    Nginx Trouble seems to be endless.

    In my last post I mentioned a solution which doesn´t work with any theme.
    I uploaded an HTML5 theme and I can´t get into my backend anymore.
    In this case I get an Error 500.

    And again heading for a solution. But at the moment I´aint got no clue where the Error is coming from.

    Has anybody any suggestions.

    Thanx in advance.
     
  13. Steveorevo

    Steveorevo New Member HowtoForge Supporter

    I also experienced a server 500 error. Installing WordPress. No lines in the error.log.

    It turns out that the 5-minute installer throws this (write permission?). Supplying a valid, manually filled out wp-config.php resolved this issue. I was expecting the "generate one for you" prompt but to no avail.

    So far, so good.
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    Your error can have 2 possible reasons:

    1) You did not choose php mode: php-fastcgi + suexec: on as described in the manual for cms sites.
    2) The wordpress files were not owned by the user and group of the website e.g. when you did not upload them by php or missed to chown them after you unpached them as root user.
     
  15. cyprus

    cyprus New Member

    I made the same experience, but I don´t need the automatic installer. So each Installation I do is manually by preparing the wp-config.php before.
     
  16. Steveorevo

    Steveorevo New Member HowtoForge Supporter

    I rolled back my Virtual Machine and checked permissions and tried again. Odd, it still throws a 500 for what should be a "Database connection error".

    In fact, on a plain WP install, simply changing the DB_NAME to something incorrect causes a 500 Server Error and not the expected DB error message. I am using a wildcard subdomain for "dev.mywebsite.com". Could that be it? I thought I have seen legitimate "DB connection error" messages on Nginx prior; perhaps they were "www" sites.
     
  17. till

    till Super Moderator Staff Member ISPConfig Developer

    Take a look at the error.log of the website, you will find the php error message there.

    The reason that you see a 500 error instead of the error message on the page is a configuration option in the php.ini file. All current php versions of the Linux distributions have display_errors set to Off. If you set it to On and restart apache afterwards, you will see php errors in the page.
     
  18. Steveorevo

    Steveorevo New Member HowtoForge Supporter

    Hi Till,
    Thank you for your reply. Sorry, I think I posted in the wrong thread. This was in response to Cyprus' "Nginx Trouble seems to be endless."

    Nginx seems to be fine (and fast!). But I am experiencing this on Nginx, not Apache. I tried setting display_errors = true and then display_errors = On in the ISPConfig php.ini options, but I'm still seeing a 500 Server Error if I purposely put in a wrong database name. This of coarse, is not something I would normally run a site with anyways. Thank you for your feedback :)
     
  19. till

    till Super Moderator Staff Member ISPConfig Developer

    It does not matter if you use apache or nginx for this problem as it is a php setting. If you use nginx, then the php-fpm servers ahve to be restarted after the php.ini change to tell php to show errors on the screen instead of logging i to the file. If you do any changes in ispconfig instead of editing the php.ini like i suggested, then ensure that you waited until they got written to disk, you can see this in the monitor.
     
  20. Steveorevo

    Steveorevo New Member HowtoForge Supporter

    Hi Till,
    I waited for the update to flush the queue. Its late here in California. But I'll roll back my VM later and see if I can duplicate the issue (hopefully not possible), but will apply your steps as suggested. Thank you for your followup!

    Regards,
    Steve
     

Share This Page