我在CentOs 7 Apache服务器中使用httpd.conf的以下配置来运行" site1":
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Richiedi qui il tuo preventivo</h4>
</div>
<div class="modal-body">
<div class="top-content">
<div class="inner-bg">
<div class="container">
<div class="row">
<div class="col-sm-5">
<div class="description">
</div>
</div>
</div>
<div class="row">
<div class="col-sm-5 form-box">
<form role="form" action="" method="post" class="registration-form">
<fieldset>
<div class="form-top">
<div class="form-top-left">
<h3>Parte 1</h3>
<p>Racontati chi sei:</p>
</div>
<div class="form-top-right">
<i class="fa fa-user"></i>
</div>
</div>
<div class="form-bottom">
<div class="form-group">
<label class="sr-only" for="form-first-name">Nome</label>
<input type="text" name="form-first-name" placeholder="Nome" class="form-first-name form-control" id="form-first-name">
</div>
<div class="form-group">
<label class="sr-only" for="form-last-name">Cognome</label>
<input type="text" name="form-last-name" placeholder="Cognome" class="form-last-name form-control" id="form-last-name">
</div>
<div class="form-group">
<label class="sr-only" for="form-about-yourself">Nome della tua attività</label>
<textarea name="form-about-yourself" placeholder="Nome della tua attività"
class="form-about-yourself form-control" id="form-about-yourself"></textarea>
</div>
<button type="button" class="btn btn-next">Avanti</button>
</div>
</fieldset>
<fieldset>
<div class="form-top">
<div class="form-top-left">
<h3>Parte 2</h3>
<p>Le tue informazioni di contatto:</p>
</div>
<div class="form-top-right">
<i class="fa fa-key"></i>
</div>
</div>
<div class="form-bottom">
<div class="form-group">
<label class="sr-only" for="form-email">Email</label>
<input type="text" name="form-email" placeholder="Email" class="form-email form-control" id="form-email">
</div>
<div class="form-group">
<label class="sr-only" for="form-number">Numero di telefono</label>
<input type="number" name="form-number" placeholder="Numero di telefono" class="form-password form-control" id="form-password">
</div>
<!--<div class="form-group">
<label class="sr-only" for="form-repeat-password">Repeat password</label>
<input type="password" name="form-repeat-password" placeholder="Repeat password..."
class="form-repeat-password form-control" id="form-repeat-password">
</div>-->
<button type="button" class="btn btn-previous">Indietro</button>
<button type="button" class="btn btn-next">Avanti</button>
</div>
</fieldset>
<fieldset>
<div class="form-top">
<div class="form-top-left">
<h3>Parte 3</h3>
<p>Dobbiamo avere ancora qualche informazione prima di calcolare il tuo preventivo:</p>
</div>
</div>
<div class="form-bottom">
<div class="form-group">
<label class="sr-only" for="form-number">Quante persone servi al giorno?</label>
<input type="text" name="form-facebook" placeholder="Numero" class="form-facebook form-control" id="form-question">
</div>
<div class="form-group">
<label class="sr-only" for="form-question">Compri bottiglie di plastica o di vetro?</label>
<input type="text" name="form-twitter" placeholder="Bottiglie di plastica o di vetro?" class="form-question form-control" id="form-question">
</div>
<button type="button" class="btn btn-previous">Indietro</button>
<button type="submit" class="btn">Calcola!</button>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
当我访问&#34; http://localhost&#34;时,site1及其子页面/子文件夹正常工作。 我现在希望能够显示第二个网站:访问&#34; http://localhost/site2&#34;时,我想显示文件内容&#34; test.html&#34;保存在&#34; / test&#34 ;;我应该如何编辑httpd.conf以使其正常工作?
答案 0 :(得分:0)
这不是一个不同的网站,它是一个不同的目录。不同的站点将涉及不同的主机名。
由于您已经拥有DocumentRoot "/var/www/html/site1
并且您似乎不想创建新的虚拟主机,因此您可以使用Alias
指向新的/不同的目录
另外,您只是希望site2在/ test /下加载test.html如果访问时我理解正确,只需添加正确的DirectoryIndex
指令即可。
这是:
Alias /site2 /var/www/html/site2
<Directory /var/www/html/site2>
DirectoryIndex /test/test.html
</Directory>
为此,您需要这两个模块:
您也可以在site1下使用mkdir site2,但这可能看起来更干净。