我已经安装了LAMP堆栈,并在Google Compute Engine中将我的域名“example.com”映射到我的外部IP。
现在我需要创build一个子域,并将其映射到同一个实例中的某个文件夹。
所以,我检查了https://cloud.google.com/appengine/docs/using-custom-domains-and-ssl?hl=uk#using_subdomains这个url,但没有说出如何编辑vhosts文件。
Compute Engine VM中的apacheconfiguration文件存在于etc / apache2 /文件夹中
XAMPP中的本地configuration
<VirtualHost *:8001> ServerAdmin [email protected] DocumentRoot "C:\xampp\htdocs\XYZ\public" ServerName localhost:8001 <Directory "C:\xampp\htdocs\XYZ\public"> Options Indexes FollowSymLinks MultiViews AllowOverride all Order Deny,Allow Allow from all Require all granted </Directory> </VirtualHost>
但在etc / apache2 / lamp-server.conf中 ,configuration如下
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
那么我们如何在Google计算引擎LAMP堆栈中编辑apacheconfiguration文件来添加子域并将其链接到实例中的某个文件夹呢?
由于这是一个老问题,没有一个答案仍然得到意见,我张贴卡姆兰的最后一个评论作为答案,指出在这个线程的解决scheme。