将 ASP.NET Core 作为根目录托管,将静态网站作为子目录托管

时间:2021-01-04 21:54:49

标签: apache asp.net-core ubuntu host

我目前正在努力解决以下问题。我有安装了 apache2 的 Ubuntu 服务器,我在上面托管了许多静态网站。其中一些是子文件夹,例如 www.somedomain.com/userWebsite1 和其他作为符号链接,例如www.somedomain.com/~user4。我还想以 root 身份托管 asp.net 核心应用程序,例如www.somedomain.com/。不幸的是,如果通过虚拟主机设置它,我的静态站点不起作用(找不到 404)。如果在 ASP.NET 应用程序中找不到 url,也许在 asp.net 应用程序中有一个选项可以强制搜索静态站点?目前,我无法同时在子目录和我的 ASP.NET Core 应用程序中托管静态站点:( 任何帮助表示赞赏。:)

我的 000-default.conf 文件

<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 个答案:

没有答案