Author Topic: ทำ virtual host subdomain free hosting  (Read 9938 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
ทำ virtual host subdomain free hosting
« 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
« Last Edit: พฤษภาคม 31, 2012, 12:59:13 AM by golfreeze »

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: ทำ virtual host subdomain free hosting
« Reply #1 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>

GuRakMung

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Hostneverdie
    • Email
Re: ทำ virtual host subdomain free hosting
« Reply #2 on: มิถุนายน 07, 2012, 11:35:51 AM »
สุดยอดอ่ะคะ

nokbluezz

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • host
Re: ทำ virtual host subdomain free hosting
« Reply #3 on: กรกฎาคม 14, 2012, 09:27:41 AM »
ขอบคุณมากๆครับ สำหรับข้อมูลดีๆแบบนี้

cosmoduke69

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • vps
    • Email
Re: ทำ virtual host subdomain free hosting
« Reply #4 on: ธันวาคม 27, 2012, 10:27:47 AM »
อืมมม น่าสนใจมากครับ

yellowandroid25

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: ทำ virtual host subdomain free hosting
« Reply #5 on: มิถุนายน 01, 2013, 10:23:29 PM »
ขอบคุณค่ะ มีแต่สิ่งดีๆมาแชร์กันเสมอเลย

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: ทำ virtual host subdomain free hosting
« Reply #6 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