Category: Apache

Setting IP restrictions on an apache website

Limiting IP access is a rather efficient way to restrict access to sensitive sites, such as for example phpmyadmin installations.There are multiple ways to archive this, one of the easyer ways is by setting the .htaccess file in the web directory for the specific site: The above gives you a series of examples for a local subnet (local internal network), internet subnets or single address.

Generic www tot non www redirect for apache

Step 1, Make sure you can use mod_rewrite The virtual host you want to apply the redirection on needs permissions to use mod_rewrite to perform the redirection. You will need something along these lines a little bit dependent on how your websites are configured to enable overriding options through .htaccess Step 2, Applying the redirect Edit or create the .htaccess file in the web directory for the site, and add the following redirect code

Adding apache and php to your bare server configuration

The basic Ubunu server install does not have apache and php installed by default, so you will need to add them to the system. sudo apt install apache2 php php-mysql Verify that your webserver and php are working, by visiting you public ip address. This should display the default apache welcome page. Next, navigate to /var/www/html and create a new file that will display the php configuration and thus verify that php is working correctly. […]

Adding a named site (virtual hosting) to apache

Each website you configure on your apache server gets it’s own small configuration file, which is a major improvement over the old days where one massive file configured all websites on the server. Navigate to the directory /etc/apache2/sites-available and create a new configuration file for your website. You are free to pick a name for your config file, in this example we will configure a site named webshop. cd/etc/apache2/sites-available sudo nano webshop.conf and here is […]