Step 1 — Creating the Directory Structure
The first step that we are going to take is to make a directory structure that will hold the site data that we will be serving to visitors.
Our document root, the top-level directory that Apache looks at to find content to serve, will be set to individual directories under the /var/www directory. We will create a directory for each of the virtual hosts we’ll configure.
Within each of these directories, we’ll create a folder called public_html that will hold the web pages we want to serve. This gives us a little more flexibility in how we deploy more complex web applications in the future; the public_html folder will hold web content we want to serve, and the parent folder can hold scripts or application code to support web content.
Create the directories using the following commands:
sudo mkdir -p /var/www/example.com/public_html
sudo mkdir -p /var/www/test.com/public_html
Since we created the directories with sudo, they are owned by our root user. If we want our regular user to be able to modify files in our web directories, we change the ownership, like this: Continue reading “Apache Virtual Hosts on Debian 8” »
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 email@example.com, 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