Install WordPress 3.9.1 on Fedora 20/19, CentOS/RHEL 6.5/5.10

This is guide, howto install WordPress 3.9.1 with Nginx or Apache on Fedora 20/19/18/17/16, CentOS 6.5/6.4/6.3/6.2/6.1/6/5.10 and Red Hat (RHEL) 6.5/6.4/6.3/6.2/6.1/6/5.10 servers. WordPress needs web server with PHP and MariaDB or MySQL database. This guide uses Apache web server with PHP 5.5 or Nginx web server with PHP 5.5 (PHP-FPM) and MariaDB 5.5 database server or Mysql 5.5 database server.

If you want to install WordPress with Apache then use a – [Apache] sections and if you want install WordPress with Nginx then use b – [Nginx] sections.

1. Install Needed Web and Database Servers

[Apache]

1.1a Install the whole LAMP environment with following guide

LAMP (Linux/Apache/MySQL/PHP) on Fedora, CentOS/Red Hat (RHEL)

[Nginx]

1.1b Install the whole LEMP environment with following guide

LEMP (Linux/Nginx/MySQL/PHP) on Fedora, CentOS/Red Hat (RHEL)

OR

[Apache]

1.2a Install just MariaDB or MySQL and Apache with PHP using following guides

  1. Install MariaDB 5.5 on Fedora, CentOS, Red Hat (RHEL)
  2. Install MySQL 5.5 on Fedora, CentOS, Red Hat (RHEL)
  3. Install Apache (httpd) and PHP 5.5 on Fedora, CentOS, Red Hat (RHEL)

[Nginx]

1.2b Install just MariaDB or MySQL and Nginx with PHP (PHP-FPM) using following guides

  1. Install MariaDB 5.5 on Fedora, CentOS, Red Hat (RHEL)
  2. Install MySQL 5.5 on Fedora, CentOS, Red Hat (RHEL)
  3. Install Nginx and PHP 5.5 (PHP-FPM) on Fedora, CentOS, Red Hat (RHEL)

2. Install WordPress 3.9.1 on Fedora 20/19/18/17/16, CentOS/Red Hat (RHEL) 6.5/6.4/6.3/6.2/6.1/6/5.10

2.1 Change root user

su -
## OR ##
sudo -i

2.2 Download WordPress 3.9.1 / latest

cd /tmp
wget http://wordpress.org/latest.tar.gz

[Apache]

2.3a Untar/Extract Downloaded WordPress Package

tar -xvzf latest.tar.gz -C /var/www/html

[Nginx]

2.3b Create needed directories, set permissions and untar/Extract Downloaded WordPress Package

mkdir -p /srv/www/wordpress/public_html
mkdir /srv/www/wordpress/logs
 
tar -xvzf latest.tar.gz -C /srv/www/wordpress/public_html --strip-components=1
 
chown -R apache:apache /srv/www/wordpress

Note: I use apache user and group here, because PHP-FPM runs as apache default (apache Choosed to be able to access some dir as httpd). If you use some other user on your php-fpm conf then change this accordingly.

3. Create MariaDB/MySQL Database for WordPress

3.1 Connect MariaDB/MySQL Database as root

## localhost ##
mysql -h localhost -u root -p
 
## Remote server ##
mysql -h 10.0.0.15 -u username -p

3.2 Setup MariaDB/MySQL Database for WordPress

## CREATE NEW USER ##
CREATE USER wordpress@localhost IDENTIFIED BY "some_good_password_for_wordpress";
 
## CREATE NEW DATABASE ##
CREATE DATABASE wordpress_blog;
 
## GRANT needed permissions ##
GRANT ALL ON wordpress_blog.* TO wordpress@localhost;
 
## FLUSH privileges ##
FLUSH PRIVILEGES;
 
## Exit ##
exit

4. Setup WordPress

[Apache]

4.1a Create Apache VirtualHost for WordPress

This is simple VirtualHost setup for local usage. VirtualHost is not mandatory for WordPress installation.
Add following to /etc/httpd/conf.d/wordpress.conf file:

<VirtualHost *:80>
  ServerAdmin test@test
  DocumentRoot /var/www/html/wordpress
  ServerName wordpress
 
  # Logging
  ErrorLog /var/log/httpd/wordpress-error-log
  CustomLog /var/log/httpd/wordpress-acces-log common
</VirtualHost>

Reload Apache (httpd)

/etc/init.d/httpd restart

[Nginx]

4.1b Create Nginx VirtualHost for WordPress

Create sites-available and sites-enabled directories

mkdir /etc/nginx/sites-available
mkdir /etc/nginx/sites-enabled

Include sites-enabled
Add following lines to /etc/nginx/nginx.conf file, after “include /etc/nginx/conf.d/*.conf” line (inside http block).

## Load virtual host conf files. ##
include /etc/nginx/sites-enabled/*;

Create Nginx wordpress virtual host file
Add following content to /etc/nginx/sites-available/wordpress file. This is basic Nginx virtual host config file for wordpress.

server {
    server_name wordpress;
    access_log /srv/www/wordpress/logs/access.log;
    error_log /srv/www/wordpress/logs/error.log;
    root /srv/www/wordpress/public_html;
 
    location / {
        index index.php;
    }
 
    # Disable favicon.ico logging
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
 
    # Allow robots and disable logging
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
 
    # Enable permalink structures
    if (!-e $request_filename) {
        rewrite . /index.php last;
    }
 
    # Handle php requests
    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
 
    # Disable static content logging and set cache time to max
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }
 
    # Deny access to htaccess and htpasswd files
    location ~ /\.ht {
        deny  all;
    }
}

Create symlink on sites enabled directory

cd /etc/nginx/sites-enabled/
ln -s /etc/nginx/sites-available/wordpress

Restart Nginx server

/etc/init.d/nginx restart

4.2 Set wordpress pointing to localhost (or some other host)

Add following to /etc/hosts file:

127.0.0.1  wordpress

[Apache]

4.3a Create wp-config.php

cd /var/www/html/wordpress
cp wp-config-sample.php wp-config.php

[Nginx]

4.3b Create wp-config.php

cd /srv/www/wordpress/public_html
cp wp-config-sample.php wp-config.php

4.4 Configure WordPress wp-config.php file

Open wp-config.php with text editor.

Setup at following database settings (which was created in section 3.2)

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');
 
/** MySQL database username */
define('DB_USER', 'username_here');
 
/** MySQL database password */
define('DB_PASSWORD', 'password_here');
 
/** MySQL hostname */
define('DB_HOST', 'localhost');
 
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
 
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

Insert some unique data on following section

define('AUTH_KEY',         'put your unique phrase here');
define('SECURE_AUTH_KEY',  'put your unique phrase here');
define('LOGGED_IN_KEY',    'put your unique phrase here');
define('NONCE_KEY',        'put your unique phrase here');
define('AUTH_SALT',        'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT',   'put your unique phrase here');
define('NONCE_SALT',	   'put your unique phrase here');

Generate unique phrases using pwgen
Install pwgen:

yum install pwgen

Generate phreses with pwgen:

pwgen -sy 50

Output:

l_fO1Q6\P>yYfsWZ9BY7_jj;U2k&,'5do!;rR5L!~M]y_{]~me
lOVt"rJk.rqZRUXA)VNZHs@]A1W1Zzdcb?+4y5D4'5zCYy>5lI
m8)ab[9]JO$S_;\+u0Q>e~@:VZ|N!R{u#3\NZavWZv.caQ_?GU
bu}g.6=j,6/at-lm1u2S_K>3ckX=EeI~i$?0p]zD|pO((a{b1]
#-otVokEQz9+&M0hokkKL]l*BK|c5w}bFmUZ:|=v'B:"_u^LV7
z{N*`:~6IzgL%p;#j_:8)nReK|*Cdr%#e)"F-v_VKWahLi%p\t
C+to$qo~PTq8=BD0{jv?dJyiY(L;'2sW`CnW!4*#y>|#Xpa4TF
%BCO]d}[ag5ivSZz+[ER]sr@W}`*J6](jFtQ]h>,DF<>KN?#?HXLJXB(i
~dMJ[e"S}c4R>7^Q)vG{Uq-):e}4I+]zsM@h#sz*7{Bnk}oa(y
...

Then simply use these generated phrases on WordPress config file. Remember remove or replace all quotation marks.

Check/Setup following parameters if needed:

// WordPress Database Table prefix
$table_prefix  = 'wp_';
 
// WordPress Localized Language, defaults to English
define ('WPLANG', '');
 
// For developers: WordPress debugging mode
define('WP_DEBUG', false);

Save wp-config.php file!

This guide example wp-config.php could look following

define('DB_NAME', 'wordpress_blog');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', 'some_good_password_for_wordpress');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
define('AUTH_KEY',         'l_fO1Q6\P>yYfsWZ9BY7_jj;U2k&,"5do!;rR5L!~M]y_{]~me');
define('SECURE_AUTH_KEY',  'lOVt"rJk.rqZRUXA)VNZHs@]A1W1Zzdcb?+4y5D4"5zCYy>5lI');
define('LOGGED_IN_KEY',    'm8)ab[9]JO$S_;\+u0Q>e~@:VZ|N!R{u#3\NZavWZv.caQ_?GU');
define('NONCE_KEY',        'bu}g.6=j,6/at-lm1u2S_K>3ckX=EeI~i$?0p]zD|pO((a{b1]');
define('AUTH_SALT',        '#-otVokEQz9+&M0hokkKL]l*BK|c5w}bFmUZ:|=v"B:"_u^LV7');
define('SECURE_AUTH_SALT', 'z{N*`:~6IzgL%p;#j_:8)nReK|*Cdr%#e)"F-v_VKWahLi%p\t');
define('LOGGED_IN_SALT',   '%BCO]d}[ag5ivSZz+[ER]sr@W}`*J6](jFtQ]h>,D<mA(TmdIS');
define('NONCE_SALT',	   '~dMJ[e"S}c4R>7^Q)vG{Uq-):e}4I+]zsM@h#sz*7{Bnk}oa(y');
$table_prefix  = 'wp_';
define ('WPLANG', '');
define('WP_DEBUG', false);

4.5 Finnish WordPress Configuration with Browser

Open browser and Goto following address http://wordpress/.

Setup Basic WordPress Blog Data and Create Admin User

WordPress Installation

WordPress Installation Completed

WordPress Installation Completed

5. Use WordPress

5.1 WordPress Log In

Wordpress Log In

5.2 WordPress 3.9.1 Welcome Screen and Dashboard

Wordpress 3.9.1 Welcome Screen and Dashboard

5.3 WordPress 3.9.1 Blog with Twenty Fourteen Template version 1.1

Wordpress 3.9.1 Blog with Twenty Fourteen Template version 1.1

Follow If Not True Then False Updates!

115 Comments

  1. hey, nice blog…really like it and added to bookmarks. keep up with good work

  2. Thank you for this guide.

    Really easy and simple way to install latest WordPress on CentOS and Fedora.

  3. thank you your writing style is amazing. just found your site on google. come back later for sure :)

  4. Your blog is very nice,thanks

  5. Great!
    Thanks!

    Best,
    Jozsef

  6. What about the FTP settings?
    Wordpress wants to update some plugins and asking for Hostname, FTP username and password. Do we need to have FTP server for this or there is some work around?
    Thanks.

    Best,
    Jozsef

  7. Found a solution for this as well:

    in /etc/httpd/conf/httpd.conf changed the
    User toMYuserNAME
    Group toMYgroup

    Also, did:
    # setsebool -P httpd_can_sendmail=1
    # setsebool -P httpd_can_network_relay=1
    # setsebool -P httpd_unified 1

    Best,
    Jozsef

  8. Hi.

    First of all I have to thank you for the tutorial. Very useful.

    Unfortunately I have 2 issues:

    1. After install, when trying to add a new theme I get this error: The uploaded file could not be moved to /var/www/html/wordpress/wp-content/uploads/2011/01

    I’ve change the owner and even, temporary change the rights to 777 for wp-content//upload folder. No success. I’ve also changed .htaccess. No success

    2. I think it’s related to the first issue. When trying to change permalinks to Day and name from Default the theme is no longer functional. You can’t access the posts.

    Thank You

    Linux 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:52:25 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

    • Change “/var/www/html/wordpress/wp-content/uploads/2011/01″ into “var/www/html/wordpress/wp-content/uploads/2011/01″.
      It works 100%.

  9. great post , thank you

  10. Thanks a lot

  11. Very good walk through, thanks. However I would definitely update it with how to configure SELinux in order to let apache write in the folder of uploads.

    have a look here

    http://forums.fedoraforum.org/archive/index.php/t-253532.html

    Also I cannot update the permalink’s file .htaccess . I have tried chmod and all kind of owership/group convinations but updating the permalink system from WP dashboard is not possible. Any clue?

    Thanks again for the post.

  12. How can MU or network be enabled so that you do not get forced on to sub domains, because wordpress is already installed? Add define(‘WP_ALLOW_MULTISITE’, true); to wp-config before you run the setup?

    Thanks,

    Matt

  13. Thanks a Lot

  14. My server database version is below 5.3. In that case, is there any alternate way without changing MySQL version?

    • Hi Shariar,

      Your database version is below 5.3? So could you tell your MySQL version? :)

  15. Thanks a lot!

  16. Great tutorial! How do I go about setting up another WP Blog?

    • Hi Kevin,

      Just use same method, but change location and names. :)

  17. Hi , I’m sorry what can and can not in the subject , but I have very often when approaching the site crashes gateway error 504, how to fix it ?

    • Hi TaresaDianafyn,

      HTTP 504 error is Gateway Timeout error.

      Could you first tell do you use Nginx or Apache?
      And more about your web server and PHP configurations?
      Do you get HTTP 504 errors on test server or on production server under high load?
      What you mean very often…is your setup working, but sometimes you get 504 or do you get it all page loads?

  18. Hi,
    Thanks for the tutorial. you saved my week.
    still I have one issue.Im bit new to this server stuff. nginx config file is working fine if Im using the default permalink structure only. i want to use a structure like http://example.com/2012/12/30/post-name.
    I search and found some results but nothing is working on me. Is there a way to fix this.
    Thanks again.

    • Hi kasun,

      You are welcome! :)

      Yes problem is that the WordPress permalink structure with nginx requires rewrite to index.php. Or alternatively urls have to contain index.php, like http://example.com/index.php/2012/12/30/post-name.

      I updated this guide conf and following if + rewrite do the trick:

      if (!-e $request_filename) {
          rewrite . /index.php last;
      }

      If you copy config again then it should work…please let me know, if you have still problems with it? :)

      • ya permalinks working!
        Thanks lot JR

        • Excellent! You are welcome!

          • sorry to bug you.:) but I’m using w3 total cache plugin for wordpress. once I added the config change CPU went bit high. also site became bit slow. when i disable the w3 total cache its working fine. i did one mistake. my wordpress files are in var/www/ folder. any clue?

            • No problem at all. :)

              W3 Total Cache performance depends totally your configuration?

              If you run WordPress on your own server / VPS server then W3TC is not probably the best choice for caching. It contains a lot of features, but at the same time, it is very heavy plugin to run. If you serve just almost static content, your cache time is very long and almost every page load comes from cache then it should be okay, but if you have logged in users or lot of commenters then it might be too heavy to run on every page load.

  19. Fantastic blog, thanks alot.

  20. Thanks a lot. I have successfully done all the steps, except for the pwgen one. I have RHEL 6.2. Yum said there is no package available. Could you please tell me where I can find instruction to intall this package? My linux knowledge is very shallow.
    Thanks.

    • You are welcome!

      Do you have epel repository enabled on your system?


      Available Packages
      Name : pwgen
      Arch : x86_64
      Version : 2.06
      Release : 5.el6
      Size : 19 k
      Repo : epel
      Summary : Automatic password generation
      URL : http://sf.net/projects/pwgen
      License : GPL+
      Description : pwgen generates random, meaningless but pronounceable passwords.
      : These passwords contain either only lowercase letters, or upper
      : and lower case, or upper case, lower case and numeric digits.
      : Upper case letters and numeric digits are placed in a way that
      : eases memorizing the password.

  21. Hi JR,
    I install WordPress as above and got everything smoothly. But when I tried to install a new theme with a zip file, WordPress asks me to provide log in information to FTP the file into the server. I have keyed in the correct username and password, but wordpress gives me the error: “Failed to onnect to FTP server http://www.mysite.org:21

    I have tried all the posssible ways that i can find online like change the uploads folder to wp-content/uploads, change the owner into root, change wp-upload folder to 777,etc. None of them works in my case.

    When I take a look at the server, the files is actually uploaded, just that it is not installed.

    Any idea on how to solve this?

    Thanks a lot JR

    • Are you running WordPress with Apache or Nginx?

      • Hi JR,
        I run WordPress with Apache

        • To enable WordPress plugin and template installation without FTP.

          Add following to wp-config.php file:

          define('FS_METHOD', 'direct');

          Run following commands (change paths, if needed):

          chcon -R -t httpd_sys_content_rw_t /var/www/html/wordpress/wp-content
           
          chown -R apache: /var/www/html/wordpress/wp-content

          Is it working then?

          • Hi JR,
            Yes, it finally works like a charm. Thanks you sooo much.

            May I know whether the “chcon -R ….” command is necsesary? I ran into some problem with it, and i chose to omit it. So I only add “define…” into wp-config file and do “chown…” in my system to make it work.

            • Hi Naka,

              You are welcome! And I just quickly tested this and chcon command might be unnecessary, if you have SELinux disabled, SELinux permissive mode or some other reasons… :)

              • Oh great. Thanks a lot JR

          • Dude, Dude, Dude….. Thank you for posting this. (takes gun away from temple)

  22. Thanks for your post JR! I have set up LAMP on LinuxMint12 and have a WordPress install running nicely, except for adding themes. I followed your instructions in the above comment to edit my wp-config file and used the chown command line with my user name rather than apache (apache did not work, nor did apache2).

    At this point I am no longer getting the ftp request from WordPress, but I am getting a message that a theme file cannot load and the install failed. I have tried 3 different themes and all end up having one file or another fail (no relation between them, just random files it seems).

    I also tried using sudo nautilus to copy the theme folders in, and they do copy over, but they do not show up in the themes list on the wp admin.

    Any suggestions? At this point I would love to either be able to upload themes or use nautilus to copy over theme folders and have them show up to be activated- either way would be great if you have any ideas! thanks :)

    • Hi trishia,

      Try to chown your wp-content directory owner (user and group) to www-data (recursively). If you run default apache installation then it should be www-data, I assume that this is copied from Ubuntu to LinuxMint… :)

  23. Hi,
    First of all, nice tutorial.
    I have been following your tutorial to create WordPress blog
    I used Nginx, PHP-FPM, mySQL

    I created user ‘wordpress’ with home directory and placed my wordpress file in /home/wordpress/public
    I hv created php-fpm pool with user=wordpress and group=wordpress
    I hv also created nginx conf for wordpress and place it at /etc/nginx/sites-available/wordpress and symlinks to /etc/nginx/sites-enabled/wordpress

    I can proceed with the installation of wordpress but several issue occur:
    1. The installation page is not shown properly (missing images, css not loaded)
    2. after installation, I can’t access wp-admin pages or main pages of my websites. the error is 403: Forbidden

    I use VPS and not installed wordpress locally.
    Can you tell me what seem wrong here?
    Thank you and very much appreciate~

    • sorry to reply you too soon
      but i manage to fixed my problems
      I moved the file to /var/www/wordpress which is default nginx folder

      but the question is can’t i move the folder to another location like apache with suExec?

      • Hi PeterB,

        Check /var/log/audit/audit.log file. Do you get any SELinux errors, when you try to run it under /home/wordpress/public directory?

  24. It seemed to be running smoothly until I tried to navigate to http://wordpress/ and all it gave me was “Error establishing a database connection”. Can you help in any way? Thanks!

    • Nevermind :) My password wasn’t correct when being declared in the wp_config.php file. Haha, whoops.

      • Excellent to hear that you got it solved! :)

  25. I followed the instructions here to install and run the Apache Server, MySQL and WordPress on my laptop running Fedora 16. I am trying to import content from my blog at WordPress.com. When my browser goes to:
    http://127.0.0.1/wp/wordpress/wp-admin/import.php
    I get this message: An Unexpected HTTP Error occurred during the API request.

    Like Trishia I also tried getting the plugin and putting it in the directory manually, but when I went to the dashboard page to enable it, it wasn’t even listed.

    I assume that my problem is related to not having an FTP server running on my laptop, although I never get so far as being prompted for FTP info. Anyway I tried following your suggestion to Naka on March 6, 2012. I added this line to my wp-config.php:

    define('FS_METHOD', 'direct');

    And I ran these commands after adjusting the paths:

    chcon -R -t httpd_sys_content_rw_t /var/www/html/wordpress/wp-content
    
    chown -R apache: /var/www/html/wordpress/wp-content

    This didn’t get me anywhere. At this point I’m confused as who the owner and group should be for all the WordPress directories. After running the above commands, my wp-content and its subdirectoreis are owned by apache with the group also being apache. The permissions are 755. The other directories under wordpress have my userid for both owner and group.

  26. This tutorial was phenomenal. Thank you very much.

  27. Worked like a charm!!

  28. define('FS_METHOD', 'direct');

    …I found this really useful on my SME Server 8 installation – thank you!

  29. more simple install wordpress on fedora just
    yum install wordpress

    if you want setup wizard just rename file config on /etc/wordpress/

    root file wordpress on /usr/share/wordpress

    and happy blogging :)

    • Hi noztox,

      Sometimes yes and sometimes no. Biggest disadvantage is yum updates. WordPress will be updated frequently and yum repository is always behind or maybe you want some reason run older version than yum repo version (then you have to exclude WordPress from every yum updates).

      Anyways this guide is universal method, howto install WordPress with on RHEL based distros and you can use Apache or Nginx with PHP-FPM. :)

      • hi JR,

        yups its true, sometime we need older version from wordpress and thanks on the advice
        by the way thanks for article give me 1 more knowledge about guide install nginx web server with PHP 5.4 (PHP-FPM) ^_^

        • Hi again Noztox,

          You are welcome!

          Nginx and PHP 5.4 (PHP-FPM) is excellent choice with WP (or any site). :)

  30. Hi, I have gone through all the steps in my CentOS 6.2 virtual machine but when I fire up the browser it only shows the message “Welcome to Nginx!”.. How Can I open wordpress in browser? Thanks.

  31. Hi, how would you update wordpress to a newer version. I tried pressing the “update now” link and it failed to update with this message:

    Unpacking the update

    Could not copy files.

    Installation Failed

    • Hi William,

      Are you using Apache or nginx?

      Could you also post output of following commands (replace examples with real paths):

      ls -la /your/wordpress/installation/path
       
      ls -la /your/wordpress/installation/path/documentroot
       
      uname -a
       
      lsb_release -a
  32. i have follow this tutorial step by step,
    i use nginx, when i finish and try open browser “http://192.168.2.2/wordpress/wp-admin/install.php” and i get this error
    “Something has triggered missing webpage on your website. This is the default 404 error page for nginx that is distributed with EPEL. It is located /usr/share/nginx/html/404.html

    You should customize this error page for your own site or edit the error_page directive in the nginx configuration file /etc/nginx/nginx.conf.”

    what should i do to fix it??
    thanks.

    • Hi ArdiOn,

      Could you post your WordPress virtual host config file content?

  33. Hi JR
    Great post-thanks.
    My problem still is how to autoupdate to the latest WP version using ftp autoupdate.
    I know this has been discussed but I still haven’t got it (I am using Fedora17 & btw I have this same problem with WP autoupdate on my Win7 localhost!).
    I have changed ownwership of wordpress folder from the original owner#xx to apache and same for wp-content folder/directory with no success. I did this from folder properties- there is no www-data option there(?). I will try chown www-data too and let you know how it goes.

    I would be grateful for a simple clear explanation of how to get this WP ftp autoupdate to work with Fedora localhost (I’d love to know how to fix it in IIS on Win7 too!). I have asked about this on WP.org forum with little response & it seems a common problem that WordPress have not given much help on! Best wishes & many thanks

    • Hi Richard,

      Nice to hear that you liked this post.

      Actually you should chown apache: instead www-data:, so do following:

      chown -R apache:apache /path/to/your/wordpress
       
      ## If you have SELinux enabled ##
      chcon -R -t httpd_sys_content_rw_t /path/to/your/wordpress

      And then you can set following to your wp-config.php:

      define('FS_METHOD', 'direct');
  34. Hi, I’ve gotten Nginx installed on CentOS 6.3, with MySQL and PHP-FPM and everything is okay, thanks. I currently have 10 customer websites that I host using a reseller account where each client has their own account. I want to move all of the sites to my Linode servers and instead give each site its own folder.

    How do I need to vary your instructions. I know each site has to have its own database user and password and that I install each time for each website right? Aside from that what other changes do I need to make to your instructions and what does the folder structure need to look like for each install. Thanks so much for your instructions so far too.

    • Hi Mijiale,

      Nice to hear that you got your CentOS server working with Nginx (PHP-FPM) and MySQL!

      What you think about WordPress Multisite / WordPress Network in this case? Then you need just one WordPress installation. If you want use multiple domains then check WordPress MU Domain Mapping plugin.

      • Wow, thanks. I’ve thought about going with MU before. The reason I prefer to make each wp install entirely self contained on the same server if that is possible is that I want to limit any WP problems to one installation. I’ve had situations before and I like only having that happen on a single install at a time. I have standardized on plugins where client needs match up, and when something happens on one, I have the time to try to understand it before I proceed with same on similar installs. This seems tedious but it has been a life saver. It’s easier to deal with one client at a time in this scenario than all of them. What do you think?

        My dream installation would be on FreeBSD, because I could use jails running stripped down CentOS for each WP instance. I’ve read jails are virtual containers without the performance penalty. Although FreeBSD is my favorite OS it does not have the spotlight and development that RedHat and CentOS at the VPS hosting level.

        • I see what you mean. Both have their pros and cons, so that’s why I suggested the first WordPress MU option. :)

          But it’s easy setup if you want to run ten different WordPress installs with Nginx. You can simply create ten directories with WordPress and then you need of course own databases for every install and virtual host files for every site.

          Directories like:
          /srv/www/wordpress1/public_html
          /srv/www/wordpress2/public_html
          /srv/www/wordpress3/public_html

          Databases like:
          wordpress1
          wordpress2
          wordpress3

          Finally most interesting part. You can do example following virtual host setup:

          Create file /etc/nginx/custom/wp-common.conf (this is example):

              location / {
                  index index.php;
              }
           
              # Disable favicon.ico logging
              location = /favicon.ico {
                  log_not_found off;
                  access_log off;
              }
           
              # Allow robots and disable logging
              location = /robots.txt {
                  allow all;
                  log_not_found off;
                  access_log off;
              }
           
              # Enable permalink structures
              if (!-e $request_filename) {
                  rewrite . /index.php last;
              }
           
              # Handle php requests
              location ~ \.php$ {
                  include /etc/nginx/fastcgi_params;
                  fastcgi_pass  127.0.0.1:9000;
                  fastcgi_index index.php;
                  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
              }
           
              # Disable static content logging and set cache time to max
              location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                  expires max;
                  log_not_found off;
              }
           
              # Deny access to htaccess and htpasswd files
              location ~ /\.ht {
                  deny  all;
              }

          Then you can create virtual host files (under sites-available / sites-enabled) like:

          ## WordPress 1 ##
          server {
              server_name wordpress1;
              access_log /srv/www/wordpress1/logs/access.log;
              error_log /srv/www/wordpress1/logs/error.log;
              root /srv/www/wordpress1/public_html;
           
              include /etc/nginx/custom/wp-common.conf;
          }
           
          ## WordPress 2 ##
          server {
              server_name wordpress2;
              access_log /srv/www/wordpress2/logs/access.log;
              error_log /srv/www/wordpress2/logs/error.log;
              root /srv/www/wordpress2/public_html;
           
              include /etc/nginx/custom/wp-common.conf;
          }
           
          ...

          Please let me know if you get it working or have some problems with it?

          Later you can consider PHP-FPM pools and other optimizations, if you (example) want / need several servers to process PHP etc.

          I like FreeBSD too, but you are totally right that it’s not common at the VPS hosting level.

          • I really can’t thank you enough. I’ll let you know my progress and if you don’t have a donate button get one.

            • Hi Mijiale,

              You are very welcome! I personally do not run this site because of the money, I just want to give my support to the Linux users and community. The reason why, even I run ads here is that the running this site will of course cost something. :)

              • I’m getting ready to deploy this this weekend. What do you think my minimum resources should be for the configuration I’ve described above? Right now I do have two Linodes. One is a 1024(Nginx, MySQL, WordPress) and the other a 512 (VSFTPD). Do you think I might be better off running the databases from the 512 over a private IP address or do you think its fine to run everything from the main server? I’m only looking at putting maybe 10 sites on the server if even that many. Thanks again.

                • Hi Mijiale,

                  Actually all depends on the amount of traffic and concurrent users / connections and amount of RAM what one running php process needs. Can you tell me any estimate about total traffic? Example total page loads per month or day?

                  Then there are many simple and effective caching techniques that can reduce the load on the server and reduce page loading time.

                  • There all organizational sites with pretty flat usage per month. Only 2 get say 100 page views per week. The rest don’t do that in a month.

                    • Okay, then your Linode 1024 (Nginx, PHP-FPM, MySQL, WordPress) is more than enough. :) You can easily handle several thousands page views per day with Linode 1024. Actually you can do it even with your Linode 512. :)

  35. Awesome post ! Helped me so much, thank you !

  36. Okay I initially installed for a single site and then split the virtual host file as you said and got it working both time. I am by the way using the unix socks call vs. 127.0.0.1… Everything is fine except this, when I went to upload a plugin I got Unable to create directory… Is its parent directory writable by the server? Not really sure what the issue is at this point. Do I need to specify somewhere that directory isn’t /srs/www/wordpress but /srv/www/wordpress01 somewhere and if so, where. Thanks.

    • Hi Mijiale,

      Nice to hear that you got it working.

      Could you post output of following commands:

      ls -la /srv/www/wordpress01/public_html/wp-content
       
      ls -la /srv/www/wordpress01/public_html/wp-content/plugins
      • Output to the first command is:
        total 20
        drwxr-xr-x 4 33 tape 4096 Sep 6 12:43 .
        drwxr-xr-x 5 nginx nginx 4096 Oct 22 23:20 ..
        -rw-r–r– 1 33 tape 28 Jan 8 2012 index.php
        drwxr-xr-x 3 33 tape 4096 Sep 6 12:43 plugins
        drwxr-xr-x 4 33 tape 4096 Sep 6 12:43 themes

        Output to the second list is:
        total 20
        drwxr-xr-x 3 33 tape 4096 Sep 6 12:43 .
        drwxr-xr-x 4 33 tape 4096 Sep 6 12:43 ..
        drwxr-xr-x 2 33 tape 4096 Sep 6 12:43 akismet
        -rw-r–r– 1 33 tape 2262 Nov 10 2010 hello.php
        -rw-r–r– 1 33 tape 30 Apr 15 2009 index.php

        Thanks.

        • OK, I have found this is a very old error. Not wanting to 777 the entire directory I tried creating each of the required directories manually and then changing the owner of each to Nginx. It’s still not working, but I now have a new error, so perhaps that is progress. “The uploaded file could not be moved to /srv/www/wordpress01/public_html/wp-content/uploads/2012/10″. Is this because tmp is not owned by nginx? On one site they suspect mod-secure could be the issue. On another don’t run php in safe mode. As you know I’m using a linode, so I do have more flexibility and SELinux is disabled.

          • Yes, this is permission problem and 777 permissions is not needed. Could you also post output of following command:

            grep -H -e "user =" -e "group =" /etc/php-fpm.d/*.conf
            • This is the grep you wanted.

              /etc/php-fpm.d/www.conf:;listen.group = nobody
              /etc/php-fpm.d/www.conf:user = apache
              /etc/php-fpm.d/www.conf:group = apache

              Apache is even on my system. I’m guessing you want me to change both of those apache references to nginx right? Since I don’t know why this is like that, I’ll wait for you to tell me lol. Thanks.

              • I also wanted to add since I did look at the php conf file referenced that I did NOT use the listen = 127.0.0.1:9000, but rather listen = /tmp/php5-fpm.sock. Therefore here are additional code blocks in the conf for you to consider:

                ; List of ipv4 addresses of FastCGI clients which are allowed to connect.
                ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
                ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
                ; must be separated by a comma. If this value is left blank, connections will be
                ; accepted from any ip address.
                ; Default Value: any
                listen.allowed_clients = 127.0.0.1

                ; Set permissions for unix socket, if one is used. In Linux, read/write
                ; permissions must be set in order to allow connections from a web server. Many
                ; BSD-derived systems allow connections regardless of permissions.
                ; Default Values: user and group are set as the running user
                ; mode is set to 0666
                ;listen.owner = nobody
                ;listen.group = nobody
                ;listen.mode = 0666

                ; Unix user/group of processes
                ; Note: The user is mandatory. If the group is not set, the default user’s group
                ; will be used.
                ; RPM: apache Choosed to be able to access some dir as httpd
                user = apache
                ; RPM: Keep a group allowed to write in log dir.
                group = apache

                The third block is where the apache value is assigned but I am curious if I am to make changes in the second and first blocks or leave them as they are? Thanks again.

                • Hi Mijiale,

                  Actually this apache:apache is default config and totally okay, if you change your WordPress installation permissions accordingly (you can of course use some other user and group too). So you can chown your WordPress installation permissions to apache user and group and then uploading files should not be problem at all. :)

                  You can also comment out listen.allowed_clients = 127.0.0.1 from first section, if you use Unix socket. As comment says Makes sense only with a tcp listening socket.. :)

                  • Wow. Thanks. Upload is working great. Is this setup moderately update friendly? Right now its not a problem because I will actually do the setup several times just to familiarize myself with it. Am planning to re-roll the OS again anyway because I can get it much more lean I think.

                    Also plan to incorporate your “Nginx and PHP-FPM Configuration and Optimizing Tips and Tricks” as part of the set-up too. Many thanks again.

                    • Excellent! You are welcome! :)

                      This is actually very easy setup, when you get used to it. And it’s very easy to remove or add new sites and you can run easily very nice amount of low traffic sites with one Linode 1024 server.

                      And I agree that you should check Nginx and PHP-FPM Configuration and Optimizing Tips and Tricks if you want to get the most out of your Linode VPS. ;)

  37. hi, i followed all your steps in setting up in Apache, however when i try to access the site.. it will gave me Error 504 Gateway timeout. thank you for posting this tutorial by the way :)

    • Hi nappy,

      Do you try to access WordPress site on localhost or remote host?

  38. Hello, JR:

    I must thank you for this tutorial. It helped me greatly. I have set up wordpress (chinese language version) with mysql, nginx, php-fpm on my CentOS 6.3 system, but finally, I got stuck at this point:
    When I upload a theme file, it forces me to input ftp connecting info, including hostname, ftp username and ftp password.

    I guess this must be an old problem, and maybe only need a little trick. I tried a ton of ways, including the Q&A above and others from google, but this problem has not been solved yet. I even disabled the SELinux, and reboot the OS, but it still does not work, so I enabled it again. It has cost me the last night, and even the whole day today, so I have to ask for help.

    This is the info of my wordpress installation environment:

    1.permission of wordpress directory:

    # ll /srv/www/
    total 4
    drwxr-xr-x. 4 nginx nginx 4096 Oct 31 21:35 wordpress

    2.I changed the rights to 777 for wp-content directory (and its subs), so it looks like this:

    drwxrwxrwx. 6 nginx nginx 4096 Nov 1 17:50 wp-content

    3.The content of wp-config.php:

    define('DB_NAME', 'wordpress_blog');
    define('DB_USER', 'wordpress123');
    define('DB_PASSWORD', 'some_good_password_for_wordpress222');
    define('DB_HOST', 'localhost');
    define('DB_CHARSET', 'utf8');
    define('DB_COLLATE', '');
    define('AUTH_KEY', '0GGgF}D9c7=hc]H:U8[>!f?IcB+E?}k>gkY&@flMU{lsh8a`1TkB-]z[/xp-m1W>');
    define('SECURE_AUTH_KEY', 'b|:SS>[(`u+!{tBSFFDCxBm,`=?03uQJfI9/8vpU:JS_/i$+4=4;KOr}6(s)63ad');
    define('LOGGED_IN_KEY', 'w@(^W(r_Y%p-+IU_XRp.V#u]kJB66)h0qRTJ&E1+f:@aLkUg}|[A5NgI|./|z;^k');
    define('NONCE_KEY', 'tDE[?Z5mf^STlV`@6OaVaOl>Lqs#s G3OLb`-r1,gt#o|^r|Bi;r0OSh-x|0.356');
    define('AUTH_SALT', 'q+@P1$A;};.:j&yk<hM(_?yNXr@.s#:;vBb)-?5^cOP_S}h=Xn<NfG0W??qR~V/`');
    define('SECURE_AUTH_SALT', 'wZ9UEeMhi2+.BR tOr+C{?5p*I-Vm.;]Nti6yL$B4=1`A-N875WIC2FXT{R4frb7');
    define('LOGGED_IN_SALT', 'IBzozt 6ZjqS#:id|w|D(@s,chldzTCZmK 0@_aW');
    $table_prefix = 'wp_';
    define('WPLANG', 'zh_CN');
    define('WP_DEBUG', true);
    /* Added by myself */
    define(“FS_METHOD”, “direct”);
    define(“FS_CHMOD_DIR”, 0777);
    define(“FS_CHMOD_FILE”, 0777);
    if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');
    require_once(ABSPATH . 'wp-settings.php');

    4.The config info of nginx:

    # cat /etc/nginx/nginx.conf

    user nginx;
    worker_processes 1;

    error_log /var/log/nginx/error.log warn;
    pid /var/run/nginx.pid;

    events {
    worker_connections 1024;
    }

    http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

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

    access_log /var/log/nginx/access.log main;

    sendfile on;
    #tcp_nopush on;

    keepalive_timeout 65;

    #gzip on;

    include /etc/nginx/conf.d/*.conf;

    ## Load virtual host conf files. ##
    include /etc/nginx/sites-enabled/*;
    }

    5.The config info of php-fpm:

    # cat /etc/php-fpm.d/www.conf
    ; Start a new pool named 'www'.
    [www]

    ; The address on which to accept FastCGI requests.
    ; Valid syntaxes are:
    ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
    ; a specific port;
    ; 'port' - to listen on a TCP socket to all addresses on a
    ; specific port;
    ; '/path/to/unix/socket' - to listen on a unix socket.
    ; Note: This value is mandatory.
    listen = 127.0.0.1:9000

    ; Set listen(2) backlog. A value of '-1' means unlimited.
    ; Default Value: -1
    ;listen.backlog = -1

    ; List of ipv4 addresses of FastCGI clients which are allowed to connect.
    ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
    ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
    ; must be separated by a comma. If this value is left blank, connections will be
    ; accepted from any ip address.
    ; Default Value: any
    ;listen.allowed_clients = 127.0.0.1

    ; Set permissions for unix socket, if one is used. In Linux, read/write
    ; permissions must be set in order to allow connections from a web server. Many
    ; BSD-derived systems allow connections regardless of permissions.
    ; Default Values: user and group are set as the running user
    ; mode is set to 0666
    ;listen.owner = nobody
    ;listen.group = nobody
    ;listen.mode = 0666

    ; Unix user/group of processes
    ; Note: The user is mandatory. If the group is not set, the default user's group
    ; will be used.
    ; RPM: apache Choosed to be able to access some dir as httpd
    user = apache
    ; RPM: Keep a group allowed to write in log dir.
    group = apache

    ; Choose how the process manager will control the number of child processes.
    ; Possible Values:
    ; static - a fixed number (pm.max_children) of child processes;
    ; dynamic - the number of child processes are set dynamically based on the
    ; following directives:
    ; pm.max_children - the maximum number of children that can
    ; be alive at the same time.
    ; pm.start_servers - the number of children created on startup.
    ; pm.min_spare_servers - the minimum number of children in 'idle'
    ; state (waiting to process). If the number
    ; of 'idle' processes is less than this
    ; number then some children will be created.
    ; pm.max_spare_servers - the maximum number of children in 'idle'
    ; state (waiting to process). If the number
    ; of 'idle' processes is greater than this
    ; number then some children will be killed.
    ; Note: This value is mandatory.
    pm = dynamic

    ; The number of child processes to be created when pm is set to 'static' and the
    ; maximum number of child processes to be created when pm is set to 'dynamic'.
    ; This value sets the limit on the number of simultaneous requests that will be
    ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
    ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
    ; CGI.
    ; Note: Used when pm is set to either 'static' or 'dynamic'
    ; Note: This value is mandatory.
    pm.max_children = 50

    ; The number of child processes created on startup.
    ; Note: Used only when pm is set to 'dynamic'
    ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
    pm.start_servers = 5

    ; The desired minimum number of idle server processes.
    ; Note: Used only when pm is set to 'dynamic'
    ; Note: Mandatory when pm is set to 'dynamic'
    pm.min_spare_servers = 5

    ; The desired maximum number of idle server processes.
    ; Note: Used only when pm is set to 'dynamic'
    ; Note: Mandatory when pm is set to 'dynamic'
    pm.max_spare_servers = 35

    ; The number of requests each child process should execute before respawning.
    ; This can be useful to work around memory leaks in 3rd party libraries. For
    ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
    ; Default Value: 0
    ;pm.max_requests = 500

    ; The URI to view the FPM status page. If this value is not set, no URI will be
    ; recognized as a status page. By default, the status page shows the following
    ; information:
    ; accepted conn - the number of request accepted by the pool;
    ; pool - the name of the pool;
    ; process manager - static or dynamic;
    ; idle processes - the number of idle processes;
    ; active processes - the number of active processes;
    ; total processes - the number of idle + active processes.
    ; The values of 'idle processes', 'active processes' and 'total processes' are
    ; updated each second. The value of 'accepted conn' is updated in real time.
    ; Example output:
    ; accepted conn: 12073
    ; pool: www
    ; process manager: static
    ; idle processes: 35
    ; active processes: 65
    ; total processes: 100
    ; By default the status page output is formatted as text/plain. Passing either
    ; 'html' or 'json' as a query string will return the corresponding output
    ; syntax. Example:
    ; http://www.foo.bar/status
    ; http://www.foo.bar/status?json
    ; http://www.foo.bar/status?html
    ; Note: The value must start with a leading slash (/). The value can be
    ; anything, but it may not be a good idea to use the .php extension or it
    ; may conflict with a real PHP file.
    ; Default Value: not set
    ;pm.status_path = /status

    ; The ping URI to call the monitoring page of FPM. If this value is not set, no
    ; URI will be recognized as a ping page. This could be used to test from outside
    ; that FPM is alive and responding, or to
    ; - create a graph of FPM availability (rrd or such);
    ; - remove a server from a group if it is not responding (load balancing);
    ; - trigger alerts for the operating team (24/7).
    ; Note: The value must start with a leading slash (/). The value can be
    ; anything, but it may not be a good idea to use the .php extension or it
    ; may conflict with a real PHP file.
    ; Default Value: not set
    ;ping.path = /ping

    ; This directive may be used to customize the response of a ping request. The
    ; response is formatted as text/plain with a 200 response code.
    ; Default Value: pong
    ;ping.response = pong

    ; The timeout for serving a single request after which the worker process will
    ; be killed. This option should be used when the 'max_execution_time' ini option
    ; does not stop script execution for some reason. A value of '0' means 'off'.
    ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
    ; Default Value: 0
    ;request_terminate_timeout = 0

    ; The timeout for serving a single request after which a PHP backtrace will be
    ; dumped to the 'slowlog' file. A value of '0s' means 'off'.
    ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
    ; Default Value: 0
    ;request_slowlog_timeout = 0

    ; The log file for slow requests
    ; Default Value: not set
    ; Note: slowlog is mandatory if request_slowlog_timeout is set
    slowlog = /var/log/php-fpm/www-slow.log

    ; Set open file descriptor rlimit.
    ; Default Value: system defined value
    ;rlimit_files = 1024

    ; Set max core size rlimit.
    ; Possible Values: 'unlimited' or an integer greater or equal to 0
    ; Default Value: system defined value
    ;rlimit_core = 0

    ; Chroot to this directory at the start. This value must be defined as an
    ; absolute path. When this value is not set, chroot is not used.
    ; Note: chrooting is a great security feature and should be used whenever
    ; possible. However, all PHP paths will be relative to the chroot
    ; (error_log, sessions.save_path, ...).
    ; Default Value: not set
    ;chroot =

    ; Chdir to this directory at the start. This value must be an absolute path.
    ; Default Value: current directory or / when chroot
    ;chdir = /var/www

    ; Redirect worker stdout and stderr into main error log. If not set, stdout and
    ; stderr will be redirected to /dev/null according to FastCGI specs.
    ; Default Value: no
    ;catch_workers_output = yes

    ; Limits the extensions of the main script FPM will allow to parse. This can
    ; prevent configuration mistakes on the web server side. You should only limit
    ; FPM to .php extensions to prevent malicious users to use other extensions to
    ; exectute php code.
    ; Note: set an empty value to allow all extensions.
    ; Default Value: .php
    ;security.limit_extensions = .php .php3 .php4 .php5

    ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
    ; the current environment.
    ; Default Value: clean env
    ;env[HOSTNAME] = $HOSTNAME
    ;env[PATH] = /usr/local/bin:/usr/bin:/bin
    ;env[TMP] = /tmp
    ;env[TMPDIR] = /tmp
    ;env[TEMP] = /tmp

    ; Additional php.ini defines, specific to this pool of workers. These settings
    ; overwrite the values previously defined in the php.ini. The directives are the
    ; same as the PHP SAPI:
    ; php_value/php_flag - you can set classic ini defines which can
    ; be overwritten from PHP call 'ini_set'.
    ; php_admin_value/php_admin_flag - these directives won't be overwritten by
    ; PHP call 'ini_set'
    ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.

    ; Defining 'extension' will load the corresponding shared extension from
    ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
    ; overwrite previously defined php.ini values, but will append the new value
    ; instead.

    ; Default Value: nothing is defined by default except the values in php.ini and
    ; specified at startup with the -d argument
    ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]
    ;php_flag[display_errors] = off
    php_admin_value[error_log] = /var/log/php-fpm/www-error.log
    php_admin_flag[log_errors] = on
    ;php_admin_value[memory_limit] = 128M

    ; Set session path to a directory owned by process user
    php_value[session.save_handler] = files
    php_value[session.save_path] = /var/lib/php/session

    6.Other info:

    # uname -a
    Linux 1.2 2.6.32-279.11.1.el6.i686 #1 SMP Tue Oct 16 14:40:53 UTC 2012 i686 i686 i386 GNU/Linux
    # lsb_release -a
    LSB Version: :core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
    Distributor ID: CentOS
    Description: CentOS release 6.3 (Final)
    Release: 6.3
    Codename: Final

    I wonder whether all the info is enought?

    Many thanks…

    • Hello Jack,

      Thank you for this information. It’s totally enough. :) And you have almost everything right places, but based on this information, it looks like problem is permissions on your wordpress directory.

      You have two option change wordpress directory permissions to apache:apache or alternatively change php-fpm run as nginx user and nginx group.

      I recommend you to change permissions to apache and then you don’t have problems with sessions etc. So do following as root:

      chown -R apache:apache /srv/www/wordpress

      And try again.

      If you want change php-fpm user and group to nginx then modify /etc/php-fpm.d/www.conf, like:

      ; Unix user/group of processes
      ; Note: The user is mandatory. If the group is not set, the default users group
      ; will be used.
      ; RPM: apache Choosed to be able to access some dir as httpd
      user = nginx
      ; RPM: Keep a group allowed to write in log dir.
      group = nginx

      Restart php-fpm and try again.

      • Hi, JR
        Thousands of thanks to you!

        I tried the first way, and it worked very well. Then I rolled back it, and tried the second way, it worked also well.

        In fact, I had tried the second way before, but I didn’t restart php-fpm, so I know now this is just what the problem is.

        But I still have a question:
        Why didn’t you use apache:apache in your tutorial instead of nginx:nginx, or tell people to change php-fpm user and group to nginx by modifying /etc/php-fpm.d/www.conf?

        I guess you must have a just cause, so what’s that?

        Many thanks again.

        • Hi again Jack,

          You are very welcome! Nice to hear that you got it working! :)

          And about your question…this is totally my mistake on this guide and it’s fixed now. I had earlier part about modifying php-fpm pool conf, but I removed it, because using nginx user/group might cause some another problems example with sessions and I obviously forgot change permissions accordingly. Sorry for inconvenience caused by this mistake. I have to yet test this guide once again on clean installed system. :)

          • Hi, JR

            It’s my great pleaser to hear that my question helped you to improve this tutorial, so it will help people more smoothly.

            And, I also learned a lot from your answer.
            It’s very kind of you, thank you indeed!

            • Your question was excellent! :) Now I tested nginx part again and uploads should work now smoothly.

              You are very welcome!

  39. Hi JR,

    First of all thank you for the blog, it’s been a great help already.

    I’m not installing wordpress but having followed your guide exactly (apart from changing to my own domain names) for installing NGINX and PHP-FPM on a clean CentOS 5.8 VPS I thought this comment thread might have an answer.

    I’m installing the Simple Machines Forum and it needs FTP access for initial configuration and for adding modules.

    All I need is read/write access to the /srv/www directory as an ftp user with VSFTPD while preserving all the nginx file ownership and still running nginx as the nginx user.

    Do you know of the simplest way I can do this?

    Thank you in advance,

    David

    • Hi David,

      You probably have same problem what I discuss with Jack before. I accidentally forgot change nginx user/group to apache and it cause this style problems with WordPress. And I use also SMF 2 on IF !1 0 forums and I can install modules without ftp when I have proper permissions.

      So what I recommend you to test, is simple change your SMF installation directory user / group to apache, like:

      chown -R apache:apache /srv/www/your_smf_installation

      Then try use SMF Package Manager. Is it working then?

      • Wow, I can’t believe it was such a simple problem. I was up until 4am the other night trying to fix it.

        Thank you very much for the help, greatly appreciated!

        • You are very welcome! Nice to hear that you got it working. :)

  40. Hi, I have had an error, the browse can’t the database, the mistake:

    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);

    my solution:

    /** MySQL hostname */
    define(‘DB_HOST’, ’127.0.0.1′);

    • Hi christian,

      Normally localhost points to 127.0.0.1.

      What is your output if you try following:

      host localhost
  41. Hey JR,

    Awesome tutorial. And thanks for having such an extensive comment/feedback from!

    I have a question about url rewrites. I’ve looked on google but only got more confused. Currently I want my url to go from:

    url/portfolio-item/blah

    to:

    url/#!blah

    At the moment, I have


    location /portfolio-item/ {
    rewrite ^/portfolio-item/(.*)$ /$1 break;
    }

    Looking through the documentation, I’m not quite sure what (.*) means, nor am I clear on the diference between “last” and “break”. If I knew them, I probably could do more.

    Any help to shed some light on this would be awesome. Thanks!

    • Hi Chris,

      Actually this looks ok, but are you sure that you want rewrite to url/#!blah?

      (.*) means everything here

      last – completes processing of current rewrite directives and restarts the process (including rewriting) with a search for a match on the URI from all available locations.
      break – completes processing of current rewrite directives and non-rewrite processing continues within the current location block only.
      redirect – returns temporary redirect with code 302; it is used if the substituting line begins with http://
      permanent – returns permanent redirect with code 301
      More info from Nginx HttpRewriteModule.

  42. I set up a wordpress site using this guide and worked great for a centos 6.4, php, apache, mysql cluster setup. One thing that I’m not sure how to get to work is the /server-status page. I un-commented it from the httpd.conf file and when trying to browse to it I get wordpress 404 page. Does anyone have any ideas on how to get it to work?

    Thanks,
    Corey

    • Hi Corey,

      Nice to hear that you get all up and running.

      Could you post config what you use to enable /server-status page?

      Do you get anything related to this in your error_log?

      • I simply uncommented the /etc/httpd/conf/httpd.conf lines for this”

        SetHandler server-status
        Order deny,allow
        Deny from all
        Allow from .example.com

        However my wordpress.conf in /etc/httpd/conf.d/ folder looks like this:

        AllowOverride All
        Options FollowSymLinks

        DocumentRoot /usr/share/wordpress/
        ServerName example.com
        ErrorLog /var/log/httpd/wordpress-error-log
        CustomLog /var/log/httpd/wordpress-acces-log common

        example.com is our actual internal domain and external domain in the configs above. changed for security.

        • I just see the access logs showing the 404.

        • fixed html tags, sorry:
          httpd.conf

          SetHandler server-status
          Order deny,allow
          Deny from all
          Allow from .teamfreeze.com

          wordpress.conf

          AllowOverride All
          Options FollowSymLinks

          DocumentRoot /usr/share/wordpress/
          ServerName nativex.com
          ErrorLog /var/log/httpd/wordpress-error-log
          CustomLog /var/log/httpd/wordpress-acces-log common

          • ok, really feel like a noob now.

            but httpd.conf file those settings are with location tags and wordpress.conf file those setting are for directory tags then virualhost *:80 tags.

            • Thanks, you can post this config to http://pastebin.com

              But yes problem is probably following, try to use something like following in your wordpress installation .htaccess file:

              # BEGIN WordPress
              <IfModule mod_rewrite.c>
              RewriteEngine On
              RewriteBase /
              RewriteRule ^index\.php$ - [L]
              RewriteCond %{REQUEST_URI} !=/server-status
              RewriteCond %{REQUEST_FILENAME} !-f
              RewriteCond %{REQUEST_FILENAME} !-d
              RewriteRule . /index.php [L]
              </IfModule>
              # END WordPress

              Most important line here is following:

              RewriteCond %{REQUEST_URI} !=/server-status
              • Thanks very much that worked great. I always forget about the .htaccess file.

                • You are welcome! Excellent to hear that you got it working! :)

  43. I really love your site, and have used it for everything since installing fedora 18. However installing WordPress wasnt as easy as I thought. Your tutorial is very thorough,however, If you specify in step “4.2 Set wordpress pointing to localhost (or some other host)”
    that the host file must match our host name would be better. My host was automaticlly set as localhost@localdomain and when i changed that to wordpress in my host file, it broke my apache. I have since fixed the issue, but it took some time googleing to figure out what went wrong.

  44. Thanks for the step-by-step instructions – this will save me a lot of time and frustration on my next wordpress install!

  45. Hi Team,
    Yesterday i have configured wordpress on the centos6.6 and after change setting of dashboard like URL setting and domain setting it is not accessing.

    and also i am not able to access in Lan network, what should i change for lan network access.

    Please hemp mee

    • Hi varun,

      So you WordPress installed, but you can’t access it?

      Could you post your Apache or Nginx server config (virtual host) for this wordpress installation?

  46. Hi. I have WordPress installed and I can login to the admin. However, I am unable to a) Update WordPress, b) upload media, and c) install plugins. Clearly a permissions issue, so I tried sudo chown -R apache wp-content/ so that apache has write access for the directory. Then double-checked my httpd.conf file and everything looked fine. Restarted apache and the mysql daemon, logged back into the WordPress admin and tried to run updates and install plugins etc and I got this message:

    The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php

    Odd because I didn’t change any file permissions. That’s went I went searching for a solution and stumbled upon your article. Read through some of the other comments above, tried a couple of their solutions and still no luck. Frustrating as I’ve never had this issue with WordPress on other linux distros. Also hesitant to mess with the selinux configuration (which might be the problem).

    Localhost Details: Fedora 20 LAMP stack

  47. Hi JR,

    Thanks a lot for this step to step tutorial and the time you take to answer all the questions, it helps a lot.
    Like rowbust I’ve been reading a lot of comments and tried some solutions, but unfortunately I wasn’t more lucky.

    I’ve installed wordpress on Centos with apache.
    I can reach wordpress, but wp-admin/plugins.php and wp-admin/themes.php are not working (browser error message : no data received with chrome)
    My log isn’t showing anything..

    I tried
    sudo chown -R apache wordpress/
    I also gave the correct rights to wordpress directory and subdirectories.

    I’ve added an .htaccess file

    #BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

    this is my wordpress.conf

    DocumentRoot /var/www/html/wordpress
    DirectoryIndex index.php

    AllowOverride All
    Order Deny,Allow
    Allow from all

    ErrorLog /var/log/wordpress-error_log
    CustomLog /var/log/wordpress-access_log combined

    Any idea of what I’m doing wrong?
    Sorry if it’s a little bit muddled…

    • Hi Steeve,

      A few things that came to my mind.

      Did you tested it with any other browsers? (Just make sure, that it’s not problem with browser)

      Did you checked wordpress-error_log, wordpress-access_log and httpd logs?

      Do you have SELinux enabled? If yes, could you also check /var/log/audit/audit.log?

Add Comment Register



Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackbacks/Pingbacks

  1. Install Wordpress 3.0.1 on Fedora 13, CentOS 5.5, Red Hat (RHEL) 5.5/6 | WP Themes and Plugins - [...] is the original post:  Install Wordpress 3.0.1 on Fedora 13, CentOS 5.5, Red Hat (RHEL) 5.5/6 Most Related PostsHowTo …
  2. wp-popular.com » Blog Archive » Install Wordpress 3.0.1 on Fedora 13, CentOS 5.5, Red Hat (RHEL) 5.5/6 - [...] is the original post: Install Wordpress 3.0.1 on Fedora 13, CentOS 5.5, Red Hat (RHEL) 5.5/6 Tags: centos, fedora, …