Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music

All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => all application on unix knowledges by golfreeze => Topic started by: golfreeze on พฤศจิกายน 30, 2011, 11:33:04 AM

Title: ทำ virtual host subdomain free hosting
Post by: golfreeze on พฤศจิกายน 30, 2011, 11:33:04 AM
ผมลงกับ apache นะครับ สำหรับ config ก็ประมาณนี้
เวลาแอด userA เข้ามาใหม่ก็ให้ไป สร้าง public_html ของ userA ครับ ที่ /var/www/html/user/userA/public_html
config ที่ httpd.conf ก็ตามนี้ ครับผม

NameVirtualHost *:80

<VirtualHost *:80>
        ServerAdmin golfreeze[at]packetlove.com
        ServerName packetlove.com
        ServerAlias www.packetlove.com
        DocumentRoot /var/www/html
        <Directory /var/www/html>
                Options ExecCGI FollowSymlinks
                AllowOverride all
                Order allow,deny
                Allow from all

                RewriteEngine on
                RewriteCond %{HTTP_HOST} ^(www\.)?packetlove\.com$
                RewriteRule ^user/([A-Za-z0-9]+)/(.*)$ http://$1.packetlove.com/$0 [L,R]

        </Directory>
</VirtualHost>

<VirtualHost *:80>
        ServerAlias *
        UseCanonicalName Off
        LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
        CustomLog access.log vcommon
        VirtualDocumentRoot /var/www/html/user/%1/public_html
</VirtualHost>



credit by : Poramin Insom
Title: Re: ทำ virtual host subdomain free hosting
Post by: golfreeze on พฤษภาคม 31, 2012, 12:58:59 AM
<VirtualHost *:80>
        ServerAdmin golfreeze[at]packetlove.com
        ServerName packetlove.com
        ServerAlias *.packetlove.com
        DocumentRoot /var/www/html/user/www/public_html
        <Directory /var/www/html/user/www/public_html>
                Options -Indexes ExecCGI +FollowSymlinks
                AllowOverride all
                Order allow,deny
                Allow from all
                RewriteEngine on
                RewriteCond %{HTTP_HOST} !^(www\.)?packetlove\.com
                RewriteCond %{HTTP_HOST} ([^.]+)\.packetlove\.com
                #rewrite golf
                RewriteRule ^(.*)$ http://www.packetlove.com/shop/web.php?shop=%1 [L,R]
        </Directory>
</VirtualHost>
Title: Re: ทำ virtual host subdomain free hosting
Post by: GuRakMung on มิถุนายน 07, 2012, 11:35:51 AM
สุดยอดอ่ะคะ
Title: Re: ทำ virtual host subdomain free hosting
Post by: nokbluezz on กรกฎาคม 14, 2012, 09:27:41 AM
ขอบคุณมากๆครับ สำหรับข้อมูลดีๆแบบนี้
Title: Re: ทำ virtual host subdomain free hosting
Post by: cosmoduke69 on ธันวาคม 27, 2012, 10:27:47 AM
อืมมม น่าสนใจมากครับ
Title: Re: ทำ virtual host subdomain free hosting
Post by: yellowandroid25 on มิถุนายน 01, 2013, 10:23:29 PM
ขอบคุณค่ะ มีแต่สิ่งดีๆมาแชร์กันเสมอเลย
Title: Re: ทำ virtual host subdomain free hosting
Post by: golfreeze on มิถุนายน 18, 2013, 03:34:56 PM
อ่านเพิ่มเติม การทำ rewrite ได้ที่นี่ครับ

##Remapping URL
http://httpd.apache.org/docs/trunk/rewrite/remapping.html

##Rewrite howto
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
https://httpd.apache.org/docs/2.0/rewrite/rewrite_guide.html