小编Ash*_*win的帖子

同一apache服务器上的多个域名

我正在我的本地系统上测试配置以学习 Apache 配置并使用相同的方法来处理我的生产服务器。

我需要配置两个域example.comexample.org

我有 php 脚本所在的目录:

/server/example.com for example.com/server/example.org for example.org

我在两个目录上运行了这个命令:

sudo chcon -R -h -t httpd_sys_content_t /server/example.*

example.com 中的 index.php 包含

<?
$debug = ($_SERVER['HTTP_HOST'] == 'example.com');
if ($debug) echo "in example.com";
?>
Run Code Online (Sandbox Code Playgroud)

example.org 中的 index.php 包含

<?
$debug = ($_SERVER['HTTP_HOST'] == 'example.org');
if ($debug) echo "in example.org";
?>
Run Code Online (Sandbox Code Playgroud)

我还创建了一个名为example.conf下的 apache conf 文件/etc/httpd/conf.d/example.conf

以下是 .conf 文件的内容:

<VirtualHost example.com:81>
    DocumentRoot /server/example.com
    ServerName example.com
    <Directory "/server/example.com">
        AllowOverride None
        Options All …
Run Code Online (Sandbox Code Playgroud)

configuration domain apache-2.2

3
推荐指数
1
解决办法
3741
查看次数

实例首次启动时如何在 Amazon EC2 中运行脚本?

我已经为内部目的制作了自己的 AMI。如何在使用此 AMI 启动实例时运行脚本?我怎样才能做到这一点?

我目前的方法是将脚本(例如 myscript.sh)添加到/etc/rc.d/rc.local. 这是 AMI 的正确方法吗?

编辑:这是一个场景:

我已经从 EC2 实例创建了一个 AMI(EC2 映像)。现在,当一位同事使用此图像并启动一个实例时,我希望脚本在实例启动时仅运行一次。我不希望每次重启实例时都运行它。相反,仅在第一次启动实例时。

linux amazon-ec2 amazon-web-services

1
推荐指数
1
解决办法
3586
查看次数