【发布时间】:2018-07-25 02:20:27
【问题描述】:
我在 Google Compute 引擎上创建了 LAMP 实例,它之前可以正常工作,但是一旦我创建了生产和开发环境,它就无法正常工作。
到目前为止我所做的如下:-
我没有域,因此它在公共 IP 地址上运行 - 例如30.30.30.205
我在 /etc/apache2/sites-available/ 中创建了 development.conf 文件。
development.conf 内容如下:
<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.
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/production/application
Alias production
<Directory "/var/www/html/production/application">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
Order allow,deny
allow from all
</Directory>
# 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
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
基于上面的配置,我希望在 url 中实现的是 http://30.30.30.205/production,对于开发来说,它将类似于 http://30.30.30.205/development。
我在 /var/www/html 中有 2 个文件夹 - 生产和开发,我在其中设置了不同的环境。
创建配置文件后,我还在 /sites-enabled 文件夹中运行 sudo a2ensite 命令。
我没有在 /etc 中设置主机,因为我相信我没有域,但对此不确定,所以如果我需要在这里做任何事情,请指导我。
执行上述步骤后,当我尝试点击 url 时,我无法访问谷歌云上的网站。
请帮助或指导我如何解决问题。
【问题讨论】:
标签: php google-cloud-platform apache2 google-compute-engine virtualhost