0

Just migrate one site from one vps to another(ubuntu 14lts) I used virtualmin as control panel

I can access mysite via mysite.com, but can not access via www.mysite.com

Your comment welcome

Updated question:

mysite.com.conf

ServerAlias admin.mysite.com
DocumentRoot /home/mysite/public_html
ErrorLog /var/log/virtualmin/mysite.com_error_log
CustomLog /var/log/virtualmin/mysite.com_access_log combined
ScriptAlias /cgi-bin/ /home/mysite/cgi-bin/
ScriptAlias /awstats/ /home/mysite/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/mysite/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/mysite/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/mysite/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/mysite/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.mysite.com
RewriteRule ^(.*) https://mysite.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.mysite.com
RewriteRule ^(.*) https://mysite.com:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
IPCCommTimeout 31
FcgidMaxRequestLen 1073741824
<Files awstats.pl>
AuthName "mysite.com statistics"
AuthType Basic
AuthUserFile /home/mysite/.awstats-htpasswd
require valid-user
  • Do you have access to DNS records of this domain? – Willian Paixao Sep 5 '14 at 15:18
0

Test the first one with nslookup www.mysite.com, if that doesn't give you the correct IP then you need to correcty setup DNS first.

You need to have a DNS CNAME for www.mysite.com, if that's done you must configure an alias on the webserver.

Once you have that in place, you can - if wanted - rewrite URIs that don't have the www. prepended using mod_rewrite (Google doesn't like such "duplicate content"):

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
| improve this answer | |
  • nslookup www.mysite.com returns ** server can't find www.mysite.com: NXDOMAIN – arachide Sep 5 '14 at 15:29
  • nslookup mysite.com returns Non-authoritative answer: Name: mysite.com Address: 104.***.***.***(where it is) – arachide Sep 5 '14 at 15:30
  • Now what - does it exist or doesn't it? Your first comment says www.mysite.com doesn't exist, your second one says it's 104.xxx.xxx.xxx... My reply to your first comment: That means that the DNS name www.mysite.com does not exist. If you have control over your DNS, you need to create it (or let your hoster do it). – Jan Sep 5 '14 at 15:30
  • www.mysite.com returns error , mysite.com returns the correct result – arachide Sep 5 '14 at 15:33
  • So go and setup your DNS. If you have questions on how to do this, search or open another question. Also check if your webserver is properly configured. – Jan Sep 5 '14 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.