[英]PHP doesn't work on virtual host in EC2 + ubuntu + apache2
[英]How to add Virtual host on ec2 wiith Apache 2.4.18?
我正在嘗試指定EC2實例的特定文檔根目錄。 我設置了Route 53,還將DNS設置為domain。 現在域積分很好。 我還添加了主機到服務器的主機文件。 現在,我想在/etc/httpd/conf/httpd.conf
添加以下代碼。 我曾經在Apache 2.2上做過同樣的事情。
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html/xyz
ServerName xyz.com
</VirtualHost>
但是,當我打開etc/httpd/conf/httpd.conf
它似乎太小了,盡管我已經將其添加到etc/httpd/conf/httpd.conf
並且相同,然后使用service httpd restart
啟動Apache。
有人會建議我如何添加它嗎?
我在add following code to /etc/httpd/conf/httpd.conf
的底部add following code to /etc/httpd/conf/httpd.conf
<VirtualHost *:80> ServerName xyz.com RewriteEngine On #RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] DocumentRoot /var/www/html/xyz <Directory /var/www/html/xyz> DirectoryIndex index.php AllowOverride All </Directory> </VirtualHost>
保存文件並重新啟動Apache,因為一旦使用service httpd restart
服務器,它將生效。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.