M
M
Martyer2015-01-22 11:24:42
Debian
Martyer, 2015-01-22 11:24:42

vds setup? Multiple sites?

Hello. There is a VDS on Debian. Borrowed from Firstvds. I glued the domain, the site works from the /var/www folder.
Task: to make the folder "/var/www/site1" read by the request "site1.ru" and the folder "/var/www/site2" by the request "site2". Tried articles like this one: tyts. but no miracle happened. When I go to the desired domain, the Index of / page opens and the site1 and site2 folders are there. Please help anyone who has dealt with this. Thank you in advance.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Martyer, 2015-01-22
@Martyer

I solved the problem like this:
Create a configuration file for the domain
To create a file, run the command
touch /etc/apache2/sites-enabled/domain.com
Open the file for editing with any text editor convenient for you and write into it:
ServerName domain.com
ServerAlias ​​www.domain .com
DocumentRoot /var/www/sites/domain.com
CustomLog /var/www/httpd-logs/domain.com.access.log combined
ErrorLog /var/www/httpd-logs/domain.com.error.log
AddType application /x-httpd-php .php
, where instead of 1.1.1.1 - we substitute the IP of your server,
instead of domain.com - the name of your domain.

M
Michael Danilov, 2015-01-22
@MonkAlbino

In /etc/apache2/conf/apache2.conf

<VirtualHost *:80>
    DocumentRoot /var/www/site1.ru
    ServerName site1.ru
    ServerAlias www.site1.ru	
    <other>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /var/www/site2.ru
    ServerName site2.ru
    ServerAlias www.site2.ru	
    <other>
</VirtualHost>

and via SSH
It's all on your own link and written.
Now, judging by the description, Apache reads the old parameters "the site works from the /var/www folder" and shows the contents of the directory - 2 folders.

A
Alexey Tutubalin, 2015-01-22
@Kennius

If this is Apache, then there is such a lovely directive as
DocumentRoot /var/www/site1
If it's nginx
set $root_path /var/www/site1;
In any case, dig in that direction
PS In general, buy ispmanager for 150 rubles from them and everything will be in chocolate, unless of course not the cheapest tariff

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question