ori0n
ori0n

Reputation: 11

Wildcard and automatic subdomains

I was browsing the internet and I do not know what's going on anymore.

I have a vps with Centos webpanel, on vps is a script that is supposed to automatically create subdomains for users who want to add their business card.

Domain in OVH, I added in the dns zone entry: * .mysite.eu A IP vps.

File /usr/local/apache/conf.d/vhosts.conf

ServerName myserver
ServerAlias *.mysite.eu
ServerAlias www.mysite.eu
ServerAdmin [email protected]
DocumentRoot /home/lupus/public_html
UseCanonicalName Off
ScriptAlias /cgi-bin/ /home/lupus/public_html/cgi-bin/

# Custom settings are loaded below this line (if any exist)
# Include "/usr/local/apache/conf/userdata/lupus/mysite.eu/*.conf

<IfModule mod_userdir.c>
    UserDir disabled
    UserDir enabled lupus
</IfModule>

<IfModule mod_suexec.c>
    SuexecUserGroup lupus lupus
</IfModule>

<IfModule mod_suphp.c>
    suPHP_UserGroup lupus lupus
    suPHP_ConfigPath /home/lupus
</IfModule>

<Directory "/home/lupus/public_html">
    AllowOverride All
</Directory>

When trying to create a business card, the address is: https: //mysite.eu/company/%26nbsp%3B (after these strange characters, I can enter the name of the company)

And it should be: https: //company/mysite.eu

What is wrong?

Upvotes: 1

Views: 1040

Answers (1)

Muhammad Jamshed
Muhammad Jamshed

Reputation: 31

I have already sent a feature request to CWP team for this feature.

Anyhow, for the time being now, you can create wildcard subdomain through this code. Paste this code at the end of /usr/local/apache/conf.d/vhosts.conf file through SSH or file manager

# vhost_start *.yourdomain.com
ServerName _wildcard_.yourdomain.com
ServerAlias *.yourdomain.com
ServerAdmin [email protected]
DocumentRoot "/home/yourdoma/public_html"
ErrorLog "/home/yourdoma/public_html/error.log"
ScriptAlias /cgi-bin/ /home/yourdoma/public_html/cgi-bin/
# Custom settings are loaded below this line (if any exist)
# Include "/usr/local/apache/conf/userdata/yourdoma/*.yourdomain.com/*.conf
SuexecUserGroup yourdoma yourdoma
suPHP_UserGroup yourdoma yourdoma
 &lt;Directory "/home/yourdoma/public_html"&gt;
 AllowOverride All
# vhost_end *.yourdomain.com

Don't forget to replace yourdomain.com with your own domain name and yourdoma with the user name of the account.

Save the file and start using wildcard subdomains on your account.

Upvotes: 1

Related Questions