NETWORKING – SYSTEM LINUX AND WINDOWS » Blog Archive » Config virtual host Web server

NETWORKING – SYSTEM LINUX AND WINDOWS
WwW.vietsystem.org – Cùng nhau xây dựng một cộng đồng IT Việt Nam ngày một phát triển









 
Home Subscribe to Comments via RSS Upload Tong hop Video Training



Config virtual host Web server



Tổng số xem: 598 Lần, 1 Lần hôm nay



Nội dung liên kết hay

1. Add virtual domain name in DNS first.
[root@ns ~]#
vi /etc/named.conf

// add them in ‘view “internal”‘ section

zone “virtual.info” IN {

type master;

file “virtual.info.lan”;

allow-update { none; };

};

// add them in ‘view “external”‘ section

zone “virtual.info” IN {

type master;

file “virtual.info.wan”;

allow-update { none; };

};

[root@ns ~]#
cp /var/named/server-linux.info.lan /var/named/virtual.info.lan

[root@ns ~]#
cp /var/named/server-linux.info.wan /var/named/virtual.info.wan

[root@ns ~]#
vi /var/named/virtual.info.lan

// change for environment of virtual.info

$TTL
86400

@
IN
SOA
ns.server-linux.info.
root.virtual.info.
(
2007
061401
;Serial

3600
;Refresh

1800
;Retry

604800
;Expire

86400
;Minimum TTL

)
IN
NS
ns.server-linux.info.

IN
A
192.168.0.17

IN
MX 10
mail.server-linux.info.

www
IN
A
192.168.0.18

mail
IN
A
192.168.0.19

[root@ns ~]#
vi /var/named/virtual.info.wan

// change for environment of virtual.info

$TTL
86400

@
IN
SOA
ns.server-linux.info.
root.virtual.info.
(
2007
061401
;Serial

3600
;Refresh

1800
;Retry

604800
;Expire

86400
;Minimum TTL

)
IN
NS
ns.server-linux.info.

IN
A
172.16.0.82
>
IN
MX 10
mail.server-linux.info.
>

www
IN
A
172.16.0.82

mail
IN
A
172.16.0.82

[root@ns ~]#
/usr/sbin/bind-chroot-admin -e

// enable chroot

Stopping named:
[ OK ]

Starting named:
[ OK ]

[root@ns ~]#
dig www.virtual.info.

;; ANSWER SECTION:
www.virtual.info. 86400 IN A 192.168.0.18

2. Configuration on Apache
[root@www ~]#
vi /etc/httpd/conf/httpd.conf

NameVirtualHost *:80
// line 971: make valid


// bottom: add these lines

DocumentRoot /var/www/html
ServerName www.server-linux.info
ErrorLog logs/server-linux.info-error_log
CustomLog logs/server-linux.info-access_log common
SuexecUserGroup cent cent
// suexec enabled


// bottom: add these lines

DocumentRoot /home/cent/public_html
ServerName www.virtual.info
ErrorLog logs/virtual.info-error_log
CustomLog logs/virtual.info-access_log common

[root@www ~]#
vi /etc/httpd/conf.d/ssl.conf

NameVirtualHost *:443
// line 19: add this line

*
:443>
// line 81: change

SuexecUserGroup cent cent
// line 86: add this line

// add in the bottom of the file: configuration for virtual.info for SSL


DocumentRoot "/home/cent/public_html"
ServerName www.virtual.info:443
ErrorLog logs/virtual.info_ssl_error_log
TransferLog logs/virtual.info_ssl_access_log
LogLevel warn
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/pki/tls/certs/server.crt
SSLCertificateKeyFile /etc/pki/tls/certs/server.key

SSLOptions +StdEnvVars

SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

[root@www ~]#
/etc/rc.d/init.d/httpd restart

Stopping httpd:
[ OK ]

Starting httpd:
[ OK ]

3 Access to the page that is made in (2) of [3] section. It’s OK if following page is shown.
[root@www ~]#
cd /var/www/html

[root@www ~]#
chmod 700 index.cgi

[root@www html]#
ll

total 8
-rwx------ 1 cent cent 211 2007-06-14 19:53 index.cgi
-rw----r-- 1
cent cent 122 2007-06-14 19:29 index.html

null
Access to https too and make sure it’s working.
null
[4] Make a test page for [virtual.info] and make sure it’s working. It’s OK if following page is shown.
[root@www ~]#
cd /home/cent/public_html

[root@www public_html]#
vi index.cgi

#!/usr/local/bin/perl

print "Content-type: text/html\n\n";
print <<"EOM";

Virtual Host Test Page
owned by cent



EOM
exit;

[root@www public_html]#
chown cent. index.cgi

[root@www public_html]#
chmod 705 index.cgi

[root@www public_html]#
ll

total 4
-rwx---r-x 1 cent cent 240 2007-06-14 19:13 index.cgi

null
Access to https too and make sure it’s working.
null

Các bài viết gần đây nhất:



Bài viết có nội dung tương tự

Bài viết được xem nhiều

No Responses to “Config virtual host Web server”
Sorry, the comment form is closed at this time.