So i created virtual host on my droplet and connect it with a domain. Also i add CNAME record (www @). But problem is that site.com point to correct folder on server var/www/sitename/public_html, and www.site.com pointing to var/www/html why?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This comment has been deleted
This comment has been deleted
You need to configure your virtualhost to listen on www.site.com as well as site.com.
Under the ServerName site.com line, add the following:
ServerAlias www.site.com
If you already have a ServerAlias directive, simply append www.site.com to the line with a space between each alias:
ServerAlias site2.com ... www.site.com
Then restart Apache:
sudo service apache2 restart
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.