Category Archives: CentOS

Best Apache VirtualHost configuration for PHP projects

Here is an example of an Apache VirtualHost config that provides your site with security through open_basedir and writes both a regular access log, as well as a PHP error log.

<VirtualHost *:80>
ServerName      example.com
ServerAlias     www.example.com

DocumentRoot    /var/www/html/example.com

php_admin_value open_basedir /var/www/html/example.com

CustomLog       /var/log/httpd/example.com-access.log common
ErrorLog        /var/log/httpd/example.com-error.log
</VirtualHost>

Note
In order for open_basedir to work with file uploads, you need to add the following to your php.ini configuration file:

upload_tmp_dir = /tmp

I’m always looking to improve this configuration – send me a comment if you have a better version!

Installing EPEL and Remi repo on CentOS 6

Install the repos with the following commands:

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

Now, enable the Remi repo to be always enabled by editing:

sudo vim /etc/yum.repos.d/remi.repo

Set:

enabled=1

…on the topmost repo (right under the [remi] tag).

That’s it!

Source

Installing Vagrant on CentOS 6

Installing Vagrant is easy thanks to the provided RPMs.

Download RPM

wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.4.2_x86_64.rpm -O vagrant_1.4.2_x86_64.rpm

Install it

sudo rpm -i vagrant_1.4.2_x86_64.rpm

That’s it! Let’s check to make sure Vagrant works:

vagrant -v
Vagrant 1.4.2

If you want the latest version, go to the Downloads page at Vagrantup.com and find the latest version download link.
Download it in the first step instead – installing works the same.

Original source