I have an instance on Amazon AWS (Ubuntu server).
I want to create a sub-domain for my website: tools.example.com for people in the office I work in, and build tools (using PHP) so employees can work with. (code automation web-apps for ex).
I have never created a sub-domain on a Linux server myself (I usually worked with hosting companies with cPanel ect'), and I'm new to Amazon AWS, which I find very awesome, and working with a Linux server and doing everything by myself - Extremely awesome!
So I was starting to explore how to create a sub-domain on my website, and I got to a point that I know that I have 2 options, which I don't exactly know what are the differences between them, what will be the implications on my work ect'.
The first option is creating the sub-domain using Amazon Route53: http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingNewSubdomain.html
and the second option I encountered was doing this using the Ubuntu server itself, ex: https://askubuntu.com/questions/463618/setting-up-subdomain-on-ubuntu-server http://kim.sg/index.php/ubuntu/17-how-to-setup-subdomain-on-ubuntu-server-14-04
Some things seem vague for me a little bit and I will be happy to have more enlightenment points from people who know a little bit more about the theoretic "stuff" and will know to guide me to the best choice for me.
Please feel free to ask me questions.
for @Stefano Martins (28.10.2015):
Ok, I did this:
<VirtualHost *:80>
ServerName tools.example.com
ServerAdmin walid@example.com
ErrorLog /var/www/tools.example.com/logs/error.log
CustomLog /var/www/tools.example.com/logs/access.log combined
DocumentRoot /var/www/tools.example.com/public_html
</VirtualHost>
mkdir -p /var/www/tools.example.com/{public_html,logs}
sudo a2ensite tools.example.com.conf
sudo service apache2 reload
sudo find /var/www/tools.example.com/public_html -type d -exec chmod 755 {} \;
sudo find /var/www/tools.example.com/public_html -type f -exec chmod 644 {} \;
sudo adduser ubuntu www-data
sudo find /var/www/tools.example.com/public_html -type d -exec chmod 775 {} \;
sudo find /var/www/tools.example.com/public_html -type f -exec chmod 664 {} \;
My folder is the var one, not the srv.
I changed everything from srv to var and now I don't get the 403 error anymore.
but now I cant upload to /var/www/tools.example.com/public_html via FTP.
UPDATE:
I used sudo chown www-data:www-data -R /var/www/
that solved my problem.
Thanks A LOT!
I went through all that you said, and in the end when restarting with
– Rick Sanchez Oct 20 '15 at 12:21service apache2 reloadI got a lot of errors without apache2 loading back again, I had to delete all the content in the file I created and restart back again.I'm editing my main post with the outputs. Please check them out.
Where do I upload files ? under /var/www/ I have a folder called "html" where all my main domain files are (for www.example.com)
Where should the other files go :X
– Rick Sanchez Oct 28 '15 at 12:51`Forbidden
You don't have permission to access / on this server.`
– Rick Sanchez Oct 28 '15 at 12:54/home/ubuntudirectory. Then, login using SSH and run:sudo mv /home/ubuntu/my-site-dir/* /srv/www/tools.example.com/public_html;sudo chown www-data:www-data -R /srv/www/;sudo find /srv/www/tools.example.com/public_html -type d -exec chmod 755 {} \;;sudo find /srv/www/tools.example.com/public_html -type f -exec chmod 644 {} \;and you're probably good to go. – Stefano Martins Oct 28 '15 at 13:13>thing which I don't know what to write. I'm adding to my main post the outputs. – Rick Sanchez Oct 28 '15 at 13:42sudo adduser ubuntu www-data;sudo find /srv/www/tools.example.com/public_html -type d -exec chmod 775 {} \;;sudo find /srv/www/tools.example.com/public_html -type f -exec chmod 664 {} \;– Stefano Martins Oct 28 '15 at 13:51/srv/www/tools.example.com/public_html/tools.example.com– Rick Sanchez Oct 28 '15 at 13:55`Forbidden
You don't have permission to access / on this server.
Apache/2.4.7 (Ubuntu) Server at tools.example.com Port 80 `
– Rick Sanchez Oct 28 '15 at 13:58I changed my commands from srv to the var dir. not I dont get the 403 error. but I do get the FTP error again and cant upload files there.
– Rick Sanchez Oct 28 '15 at 15:34