*not* just another blog ;)

A quick tip so that I don't forget this again. By default, VestaCP will set directories to disallow listings, for example, example.com/files would show a 403 error instead of listing the contents.

Sometimes, though, it's desirable to have a list shown to the user, so all we need to do is create or modify the .htaccess file in the top level folder.

For example, in /home/user/web/example.com/public_html/files/

nano .htaccess

Add the following to ALLOW listing:

Options +Indexes   


Options -Indexes   

Hopefully this also helps someone :)

I have recently aquired a NAT VPS, which I will talk more about in a future post, but for now, I need to change the port that apache listens on from the default port 80.

Here's how I did it.

nano /etc/apache2/ports.conf

And change the "Listen" value from 80 to, in my case, 50781

Save the file, and we'll move on to the next part.

nano /etc/apache2/sites-enabled/000-default.conf

And then change the first line, which will be to (Change the port to what you'll be using)

After that's done, we need to restart Apache

systemctl restart apache2

And you should be able to access the website on your new port!

Setting up virtual hosts in Apache

- Posted in Quick Tip by with comments

This is the first in a series of quick tips that I will write up. These mainly serve to refresh my memory when I do the same thing a few times but can't quite remember the exact thing to do.

Today, I set up 2 different virtual hosts in apache:

host1.dah85.com host2.dah85.com

To accomplish this, I first created A entries for those hosts and pointed them to the IP of the web server, which in this case is a VPS for testing with.

Once that's been done, we just need to create the directories that the sites will live in, and then set up the configs.

sudo apt-get update
sudo apt-get install apache2
sudo mkdir /var/www/host1.dah85.com/public_html
sudo mkdir /var/www/host2.dah85.com/public_html
sudo chmod -R 755 /var/www
sudo chown -R www-data /var/www
sudo nano /etc/apache2/sites-available/host1.dah85.com.conf
sudo nano /etc/apache2/sites-available/host2.dah85.com.conf

Contents of host1.dah85.com.conf

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName host1.dah85.com
    DocumentRoot /var/www/host1.dah85.com/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

And host2.dah85.com.conf

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName host2.dah85.com
    DocumentRoot /var/www/host2.dah85.com/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

Then we enable the configs and restart Apache

sudo a2ensite host1.dah85.com.conf
sudo a2ensite host2.dah85.com.conf
sudo service apache2 restart

And that should be it for setting it up. Assuming you have something in each public_html directory, it should be working.