Author Topic: Temporary website url in CWP for accesing website before domain propagation  (Read 21970 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Here is little tip for creating temporary website URL for new accounts that either don't have domain or domain is not fully propagated yet.

To enable this handy feature, you will need to edit Apache vHosts file and edit entry for specific vhost, or edit Apache vHosts template to enable this feature globally for all accounts by adding just one line of code shown below:

Code: [Select]
UserDir /home/*/public_html
Simple as that, but yet very useful because with this feature you can now access website without domain. Site is now accessible via server IP address by providing ~username like this:

Code: [Select]
127.0.0.1/~username
(replace "127.0.0.1" with your real server IP address and "username" with your real username)

Here is working Apache Domain Virtual Host tpl file that I use:

Code: [Select]
# vhost_start %domain_name%
<VirtualHost %domain_ip%:%domain_port%>
ServerName %domain_name%
ServerAlias www.%domain_name%
ServerAdmin %admin_email%
DocumentRoot "%homedir%/%username%/public_html"
UserDir /home/*/public_html
ScriptAlias /cgi-bin/ "%homedir%/%username%/public_html/cgi-bin/"

# Custom settings are loaded below this line (if any exist)
# Include "/usr/local/apache/conf/userdata/%username%/%domain_name%/*.conf

<IfModule mod_suexec.c>
        SuexecUserGroup %username% %username%
</IfModule>

<IfModule mod_suphp.c>
        suPHP_UserGroup %username% %username%
        suPHP_ConfigPath /home/%username%
</IfModule>

<Directory "%homedir%/%username%/public_html">
        AllowOverride All
</Directory>

</VirtualHost>
# vhost_end %domain_name%

Note that mod UserDir needs to be installed and enabled for this.
However, in my case it was already installed and enabled :)

P.S. Maybe this could be included by default in some future CWP version ;)
« Last Edit: April 13, 2015, 01:39:37 PM by nrozic »

Offline
*
hi nrozic,

where is located the vhost tpl file?

this trick is very helpfull for migration purposes

Offline
*
i find the template, thanks a lot.

Offline
*
Hi aeanez, I'm glad if this helped you.

I forgot to mention that vhosts tpl file is accessible via CWP menu (login as root) - Apache Settings -> Edit Apache vHosts

Offline
*
How would this world is the user has more then one website ?