Hosting ASP.NET Core as root and static websites as subdirectories

Viewed 69

I'm currently struggling with the following problem. I have Ubuntu server with apache2 installed, on which I host many static websites. Some of them are sub-folders e.g www.somedomain.com/userWebsite1 and others as symlinks e.g. www.somedomain.com/~user4. I also want to host asp.net core app as root e.g. www.somedomain.com/. Unfortunately, if set this via virtual host my static sites not working (404 not found). Maybe there is an option in asp.net app to force search static sites if url is not found in ASP.NET app? Currently, I cannot host static sites in sub-directories and my ASP.NET Core App simultaneously :( Any help is appreciated. :)

My 000-default.conf file

<VirtualHost *:80>
    ProxyPreserveHost On
        ProxyPass / http://127.0.0.1:5010/
        ProxyPassReverse / http://127.0.0.1:5010/
    ServerName somedomain.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    ServerAlias www.somedomain.com
    
    <Directory />
        Options FollowSymLinks
        AllowOverride all
    </Directory>
   
    <Directory /var/www/html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Order allow,deny
        allow from all
        php_admin_value engine On
    </Directory>
    
    <Directory /home/*/public_html>
        Options +IncludesNoExec +SymLinksIfOwnerMatch 
        Order allow,deny
        allow from all
    </Directory>
    
    #<Location / >
    #       ProxyPreserveHost On
        #   ProxyPass http://127.0.0.1:5010/
        #   ProxyPassReverse http://127.0.0.1:5010/
    #</Location>

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

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
0 Answers
Related