私は現在、EVE Onlineというゲーム用に2つのサードパーティ製アプリケーションを構成しています。 1つはPathfinder、もう1つは会社管理アプリケーションです。
たとえば、Pathfinderにアクセスしたい場合は私のURLが、mydomain.com/pathfinder
他のアプリケーションにアクセスしたい場合は私のURLはですmydomain.com/otherapp
。
Pathfinderは、他のアプリケーションも必要とするDocumentRoot
フォルダ()にあります()。/var/www/pathfinder
DocumentRoot
/var/www/otherapp
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName mydomain.com
ServerAdmin [email protected]
DocumentRoot /var/www/pathfinder
# 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
RewriteEngine on
RewriteCond %{SERVER_NAME} =mydomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
ベストアンサー1
2つを作成しますVirtualHosts
(別のファイルに保存することをお勧めします)。
<VirtualHost *:80>
ServerName pathfinder.dev
ServerAlias www.pathfinder.dev
DocumentRoot /var/www/pathfinder
<Directory /var/www/pathfinder>
AllowOverride All
Order Allow,Deny
Allow from All
#...
</Directory>
#...
</VirtualHost>
<VirtualHost *:80>
ServerName otherapp.dev
ServerAlias www.otherapp.dev
DocumentRoot /var/www/otherapp
<Directory /var/www/otherapp>
AllowOverride All
Order Allow,Deny
Allow from All
#...
</Directory>
#...
</VirtualHost>
ホストファイルを編集し、/etc/hosts
次の行を追加します。
127.0.0.1 pathfinder.dev
127.0.0.1 otherapp.dev
変更を保存し、Apache サーバーを再起動します。ブラウザを開き、最初のプロジェクトhttp://pathfinder.dev
と2番目のアプリケーションに移動します。http://otherapp.dev