Virtual Hosts are used to run more than one domain off of a single IP address. This is especially useful to people who need to run several sites off of one virtual private server– each will display different information to the visitors, depending on which website the user is accessing.There is no limit to the number of virtual hosts that can be added to a VPS.
The steps in this tutorial require the user to have root privileges. You can see how to set that up in the Initial Server Setup. Choose whichever username you fancy.
Additionally, you need to have apache already installed and running on your virtual server. If you haven’t already done so, use the following command:
sudo apt-get install apache2
Continue reading “Apache Virtual Hosts on Debian 7” »
There could be many reasons why your website performance is poor, one of them can possibly be that Apache is not coping with the load. Below you’ll find ready to consume configuration to make Apache performance better using the Apache MPM prefork module.
To do this, just include the below lines into your httpd.conf apache configuration file:
MaxClients 200 #must be customized
ServerLimit 200 #must be customized
Some explanations are here:
Continue reading “Simple way to tune apache performance using mpm prefork module” »
Revealing web server signature with server/PHP version info can be a security risk as you are essentially telling attackers known vulnerabilities of your system. Thus it is recommended you disable all web server signatures as part of server hardening process.
Disable Apache Web Server Signature
Disabling Apache web server signature can be achieved by editing Apache config file.
On Debian, Ubuntu or Linux Mint:
$ sudo vi /etc/apache2/apache2.conf
Continue reading “Hiding Apache and PHP Server Signature” »
You can remove the packages in Ubuntu by executing the commands:
dpkg --purge phpmyadmin
dpkg --purge mysql-server
dpkg --purge apache2.2-common
You have option also to remove the following packages:
sudo apt-get remove apache2*
sudo apt-get remove phpmyadmin
sudo apt-get remove mysql-server
sudo apt-get remove php5
sudo apt-get --purge apache2*
sudo apt-get --purge phpmyadmin
sudo apt-get --purge mysql-server
sudo apt-get --purge php5
To enable and load mod_rewrite, do the following.
$ sudo a2enmod rewrite
Then open up the following file, and replace every occurrence of “AllowOverride None” with “AllowOverride all”.
$ sudo vi /etc/apache2/sites-available/default
$ sudo vi /etc/apache2/sites-available/000-default
Finally, restart Apache2.
$ sudo service apache2 restart
This repo can be used additionally to the squeeze-php54 repo of dotdeb.org.
Add the following into /etc/apt/sources.list
deb http://debrepo.frbit.com/ frbit-squeeze main
Add the key, update apt and install packages
wget -O – http://debrepo.frbit.com/frbit.gpg | sudo apt-key add –
aptitude install php5-igbinary php5-mongo php5-oauth php5-phalcon php5-runkit php5-stats php5-stomp php5-yaf php5-yaml
First we install MySQL 5 like this:
apt-get install mysql-server mysql-client
You will be asked to provide a password for the MySQL root user – this password is valid for the user root@localhost as well as firstname.lastname@example.org, so we don't have to specify a MySQL root password manually later on:
New password for the MySQL "root" user: <– yourrootsqlpassword
Repeat password for the MySQL "root" user: <– yourrootsqlpassword
3 Installing Apache2
Apache2 is available as a Debian package, therefore we can install it like this:
apt-get install apache2
Now direct your browser to http://192.168.0.100, and you should see the Apache2 placeholder page (It works!): Continue reading “Installing Apache2, PHP5, MySQL and PHPMyadmin On Debian” »
You can easily hide Apche (httpd) version number and other information. There are two config directives that controls Apache version. The ServerSignature directive adds a line containing the Apache HTTP Server server version and the ServerName to any server-generated documents, such as error messages sent back to clients. ServerSignature is set to on by default. The ServerTokens directive controls whether Server response header field which is sent back to clients includes a description of the generic OS-type of the server as well as information about compiled-in modules. By setting this to Prod you only displays back Apache as server name and no version number displayed back.
Open your httpd.conf file using text editor such as vi:
Append/modify config directive as follows:
Save and close the file. Restart Apache web server:
# /etc/init.d/httpd restart
First make sure your Apache configuration is set for allowing .htaccess. Read this Article first before you move to the next steps.
.htaccess File Creation:
Let's assume /test-dir1 is to be password protected.
$ cd /var/www/html/test-dir1
$ vi .htaccess
Write the following lines into this file:
AuthName "Authorized Users Only."
require user testusr
Telling Apache About Users:
Now we have to inform Apache about the user and its password.
$ htpasswd -c /etc/httpd/conf/.htpasswd testusr
The above command will work if you have htpasswd in your /usr/local/bin and it happens if you install Apache from RPM. /etc/httpd/conf/.htpasswd is the location of file that will contain the authenticated/trusted user password. Continue reading “Securing directory using .htaccess file” »