Rabu, 24 September 2014

Membuat Virtual Host Pada Fedora

Buat Folder Directorynya dulu

Code:
mkdir /var/www/html/nama-folder
Ikuti Step dibawah Ini Untuk configure virtual hosts in Apache.

Step 1: Open the Apache configuration file to edit it

Code:
#vi /etc/httpd/conf/httpd.conf
Step 2: Add the below directive to the Apache configuration file since we are using name-based virtual hosts. This directive tells the server to use any and all IP addresses on the machine.

Code:
NameVirtualHost *:80
Step 3: Add the VirtualHost block to each different website in the Apache configuration file

Code:
<VirtualHost *:80>
ServerName website1.example.com
DocumentRoot /var/www/html/website1
</VirtualHost>
The above block tells the server to run website1.example.com using the document root /var/www/html/website1.

Step 4: Add as many virtual hosts as you want using VirtualHost blocks like below:

Code:
<VirtualHost *:80>
ServerName website2.example.com
DocumentRoot /var/www/html/website2
</VirtualHost>
Save the file and exit.

Step 5: Restart Apache

Code:
#/etc/init.d/httpd restart
The virtual host configuration is done. If the hostnames are fictitious like this example,you have to add the hostnames in your network configuration.

Step 6: Open /etc/hosts
Code:
#vi /etc/hosts
Step 7: Add the host names
PHP Code:
127.0.0.1    website1.example.com
127.0.0.1    website2
.example.com 

save the file and exit.

You will now be able to access
Code:
 http://website1.example.com
at you browser

jng lupa configure AllowOverride none -> MENJADI AllowOverride All


Code:
#sudo vi /etc/httpd/conf/httpd.conff
Berikan ownership pada folder directory
Code:
#chown -R namauser.namagrup /letak-folder/
100 tested work untuk save pada editor vi gunakan perintah :wq

Tidak ada komentar:

Posting Komentar