SSL on Debian 10 Apache2

Assuming you have an SSL certificate already downloaded and available on the server.

root@www:~#nano /etc/apache2/sites-available/default-ssl.conf
# line 3: change admin email

ServerAdminwebmaster@srv.world

# line 32,33: change to the certs gotten in section [1]

SSLCertificateFile /etc/letsencrypt/live/www.srv.world/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.srv.world/privkey.pem

# line 42: uncomment and change to the chain-file gotten in section

SSLCertificateChainFile /etc/letsencrypt/live/www.srv.world/chain.pem
root@www:~#a2ensite default-ssl
Enabling site default-ssl

Continue reading “SSL on Debian 10 Apache2” »

Share

Enable mod_rewrite for Apache on CentOS 7

The mod_rewrite module is enabled by default on CentOS 7. If you find it is not enabled on your server, you can enable it by editing 00-base.conf file located in /etc/httpd/conf.modules.d/ directory.

sudo nano /etc/httpd/conf.modules.d/00-base.conf

Add or uncomment the following line:

LoadModule rewrite_module modules/mod_rewrite.so

Save and close the file, then restart the httpd service:

sudo systemctl restart httpd

Enable .htaccess File

Once the mod_rewrite module has been activated, you can set up your URL rewrites by creating an .htaccess file in your default document root directory. A .htaccess file allows us to modify our rewrite rules without accessing server configuration files. For this reason, .htaccess is critical to your web server. Before we begin, we need to allow Apache to read .htaccess files located under the /var/www/html directory. Continue reading “Enable mod_rewrite for Apache on CentOS 7” »

Share

Apache error fix on Forbidden You don’t have permission to access this resource

Tested and works on Debian/Ubuntu apache installation. For this open the apache2.conf file using the nano editor

sudo nano /etc/apache2/apache2.conf

Replace the general directory settings with this.

<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Require all granted
</Directory><Directory /usr/share>
AllowOverride None
Require all granted
</Directory><Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
#<Directory /srv/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory>

Ensure your virtual host configuration file in /etc/apache2/sites-available directory is in this manner Continue reading “Apache error fix on Forbidden You don’t have permission to access this resource” »

Share

Apache Virtual Hosts on CentOS

Step One— Create a New Directory

The first step in creating a virtual host is to a create a directory where we will keep the new website’s information.

This location will be your Document Root in the Apache virtual configuration file later on. By adding a -p to the line of code, the command automatically generates all the parents for the new directory.

sudo mkdir -p /var/www/example.com/public_html

You will need to designate an actual DNS approved domain, or an IP address, to test that a virtual host is working. In this tutorial we will use example.com as a placeholder for a correct domain name.

However, should you want to use an unapproved domain name to test the process you will find information on how to make it work on your local computer in Step Six.

Step Two—Grant Permissions

We need to grant ownership of the directory to the user, instead of just keeping it on the root system.

sudo chown -R apache:apache /var/www/example.com/public_html

Additionally, it is important to make sure that everyone will be able to read our new files.

sudo chmod 755 /var/www

Now you are all done with permissions. Continue reading “Apache Virtual Hosts on CentOS” »

Share

Apache Virtual Hosts on Debian 8

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” »

Share

Apache Virtual Hosts on Debian 7

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.

Set Up
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” »

Share

SVN Server on Ubuntu 12.04 LTS with Web Access

To install SVN server, run this command at the command prompt:

sudo apt-get install subversion libapache2-svn apache2

Make the directory where you want to keep the svn repositories and edit the dav_svn.conf file:

sudo mkdir /svn
sudo nano /etc/apache2/mods-enabled/dav_svn.conf

Delete all the data and make it simple like this 🙂

<Location /svn>
DAV svn
SVNParentPath /svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</Location>

To create a svn user , use the following command: Continue reading “SVN Server on Ubuntu 12.04 LTS with Web Access” »

Share