0

Am trying to host website example.com on my current Ubuntu server.

I have created the directories for it: /var/www/html/example.com/public_html

and within sites-enabled I created example.com.conf

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    ServerAdmin webmaster@example.com
    DocumentRoot /var/www/example.com/public_html

    <Directory /var/www/example.com/public_html>
        Options -Indexes +FollowSymLinks
        AllowOverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/example.com-error.log
    CustomLog ${APACHE_LOG_DIR}/example.com-access.log combined
</VirtualHost>

Just changed the DNS so it will take a while to make sure that part works.

However, I'm currently using the same server with just the IP address to do some Perl scripts they're called by x.x.x.x/cgi-bin/perlscript.pl

And that part has stopped working.

The error log contains

AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive

So since I just set up just the conf file for the domain name based server, did I somehow mess up everything?

Can Ubuntu host two virtual servers where one is domain name based and the other just IP based?

---UPDATE---

The DNS update was quick enough that new domain website, example.com, works. Now I just need to be able to get back to working off my other website based purely on IP address.

1

1 Answer 1

1

Sorry my mistake, turns out I missed the part of disabling the 000-default.conf

sudo a2dissite 000-default.conf

And when I made the conf files I had to make two. One for example.com and the other for the IP address website (a different website). I simply replaced all instances of

example.com

with the actual IP address for the website

For anyone coming across this same problem I found this link: How To Configure Apache Virtual Hosts In Ubuntu 18.04 LTS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.