Tag Archive: rhel


WordPress Configuration

yum  install  php   mysql-server   httpd                (CentOS repo)

yum  install  wordpress                              (EPEL repo)

Configure mysql database:

#  service  mysqld  start

#  mysqladmin  –u  root  password  [give password]

#  mysql  –u  root  -p

mysql>  create  database  wordpress  character  set  utf8  collate  utf8_bin;

mysql>  grant  all  privileges  on  wordpress.*  to  wordpress@localhost  identified  by  ‘[db_password]’;

mysql>  flush  privileges;

mysql>  exit

Configure WordPress:

#  vim  /etc/wordpress/wp-config.php

//specify database name

define(‘DB_NAME’,  ‘wordpress’);

//specify DB user

define(‘DB_USER’,  ‘wordpress’);

//specify DB password

define(‘DB_PASSWORD’,  ‘db_password’);

//specify hostname

define(‘DB_HOST’,  ‘localhost’);

Save and exit.

#  service httpd start

Open firefox and access http://hostname/wordpress/ and configure the “admin” settings.

Like http://localhost/wordpress/

😀

Advertisements

Edit the configuration file:
#  vim  /etc/httpd/conf/httpd.conf
Press ‘shift+g‘ to go at the end of file, and add:

<Directory “/var/www/html”>
AuthType Basic
AuthName “Authorized Users only”
AuthUserFile  /etc/httpd/authpass
Require user user1 user2                     //add all usernames
</Directory>

 

#  htpasswd  -b  /etc/httpd/authpass [username]  [password]

#service httpd restart

http://127.0.0.1 (it will ask for username and password for accessing the website.)

OR edit  “/etc/hosts”, add

127.0.0.1                     http://www.abc.com

Access www.abc.com from browser.

You can create a simple webserver(without SSL) from here.

Create a certificate:

#  cd  /etc/pki/tls/certs

 

Create private key:

#  make  server.key

Enter the passphrase.

Remove passphrase from private key:

#  openssl  rsa  -in  server.key  -out  server.key

 

#  make  server.csr

Enter the relevant information for your certificate.

 

Create certificate:

#  openssl  x509  -in  server.csr  -out  server.crt  -req  -signkey  server.key  -days  365

#  chmod  400  server.*

 

Configure SSL:

 

#  yum  install  mod_ssl

 

#  vi  /etc/httpd/conf.d/ssl.conf

 

Edit line no. 77 & 78:

DocumentRoot            “/var/www/html”

ServerName                http://www.abc.com:443

 

Edit line no. 105:

SSLCertificateFile        /etc/pki/tls/certs/server.crt

 

Edit line no. 112:

SSLCertificateKeyFile              /etc/pki/tls/private/server.key

(Note: Private key is also present in “certs” directory, you can specify that one also or you can copy it in “private” directory.)

 

#  service httpd start

 

Now access https://www.abc.com from browser and install the certificate.(Map server name http://www.abc.com with ip address in “/etc/hosts”)