Skip to content

Setting up CentOS 6 Web server

sergeylukin edited this page Apr 22, 2012 · 35 revisions

System settings

  • set locale to UTF-8. Add following to /etc/profile:
# set locale to UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

Users

  • useradd www
  • useradd -G www developername

Dev tools

  • yum groupinstall "Development Tools"
  • yum install man wget vim readline-devel mlocate

Apache

  • yum install httpd
  • chkconfig --levels 235 httpd on
  • chown www:www /var/www -R
  • Set ServerName to 127.0.0.1:80 and NameVirtualHost to *:80 in /etc/httpd/conf/httpd.conf
  • add Include virtuals/* to /etc/httpd/conf/httpd.conf
  • Add Virtual hosts files in /etc/httpd/virtuals/

Ruby

Install YAML (required):

Install RUBY:

  • cd /usr/local/src
  • download & extract latest version from http://www.ruby-lang.org/en/downloads/
  • change directory to ruby's source
  • ./configure --prefix=/usr/local --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
  • make && make install

Ruby Gems

Gems

  • gem install jekyll

PHP

  • as described here
  • ..
  • ./configure --prefix=/usr/local --with-apxs2=/usr/sbin/apxs'
  • make && make install
  • ..
  • add following to /etc/httpd/conf.d/php.conf:
# PHP Configuration for Apache
#
# Load the apache module
#
LoadModule php5_module modules/libphp5.so
#
# Cause the PHP interpreter handle files with a .php extension.
#
<Files *.php>
  SetOutputFilter PHP 
  SetInputFilter PHP 
  LimitRequestBody 9524288
</Files>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
  • Disable SELinux: set SELINUX=disabled in /etc/selinux/config (reboot to apply changes or run /usr/sbin/setenforce 0)
  • Copy /usr/local/src/php/php.ini-dev /usr/local/lib/php.ini