Issue
is there a way to have a LAMP server and create subdomain programatically via PHP?
I don't want to install Plesk or cPanel, I know they have API's which lets me create subdomains. But is there a way to go around them and have a bare server with just LAMP services installed.
Solution
You can look at the mass virtual hosting module provided by Apache:
With your PHP, when you want to create a new domain, simply create a new directory ... and implement parts of this configuration (consult the link above) on how to configure your Apache. This will allow a seperate vhost per host ... as opposed to the alternate answer which still requires more configuration work per unique hostname...
# get the server name from the Host: header
UseCanonicalName Off
# this log format can be split per-virtual-host based on the first field
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon
# include the server name in the filenames used to satisfy requests
VirtualDocumentRoot /www/hosts/%0/docs
VirtualScriptAlias /www/hosts/%0/cgi-bin
Answered By - sdolgy
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.