【发布时间】:2018-07-26 13:05:20
【问题描述】:
我有一个使用域 example.com 的服务器。我正在使用 apache 来运行这个 Web 服务器。我还安装了 Dot Net core 并将 Dot Net core 应用程序发布到 /var/www/app 位置。
我正在尝试使用 example.com/api 访问此应用程序
这是我在 000-default.conf 中尝试过的
<VirtualHost *:80>
ServerAdmin root@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
the below is what I hvae added for the application
<VirtualHost *:80>
ServerName example.com/api
ProxyPreserveHost On
<Proxy *>
Order allow, deny
Allow from all
</Proxy>
ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
</VirtualHost>
我也试过下面的配置。
<VirtualHost *:80>
ServerName example.com/api
redirect / http://localhost:5000/
</VirtualHost>
谁能帮我找出我做错了什么以及如何正确地做到这一点。
【问题讨论】:
标签: apache .net-core webserver