我必须预测一个已经在root运行的项目,例如:http://www.example.com,现在我希望将另一个名为Vuejs的项目部署在同一域中。让我们在http://www.exampple.com/vue-project
说我正在使用apache2并将其配置为返回根项目(Angular)的index.html
但是我希望它在我打开http://www.example.com/vue-project
时返回vue项目的index.html文件。我尝试为vue-project创建一个别名到vuejs项目的根目录
,并且当我删除代码以返回角度项目的index.html时,它确实起作用。
这是我的000-default.conf文件
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName www.example.com
Alias "/vue-project" "/etc/tether/vue-project/dist"
RewriteEngine On
#RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ http://www.%1%{REQUEST_URI} [L,NE,R=301]
RewriteCond %{REQUEST_URI} !^/index.html$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(json|css|gif|ico|jpg|js|png|swf|txt|svg|woff|ttf|eot)$
RewriteRule . /index.html [L]
ServerAdmin webmaster@localhost
DocumentRoot /var/www
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
ServerAlias example.com
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>
</IfModule>