Answer the question
In order to leave comments, you need to log in
Setting up two domains on the same server?
Hey!
There is a VPS server, zero, you can install either centos (5.6) or debian (6.7).
I will give preference to setting up on debian 7, the installation is minimal, there is only root access. actually the question is:
how to create two www-directories in nginx or apache2 (nginx is better), so that these directories are responsible for two different domains.
I know how to install this whole thing, the only question is about setting it up. and I would not want to install bind9, dns-s are registered through the domain registrar on Yandex.
it is desirable that all this be in the web-panel. The server has only one IP address.
do not offer to install web panels: webmin, ajenti, zpanel,
Answer the question
In order to leave comments, you need to log in
Debian 7, nginx nginx
configuration example for two servers:
server {
listen 80;
server_name pma.example.com;
root /var/www/phpmyadmin/;
error_log /var/log/nginx/pma-err.log;
location / {
index index.php index.html;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm-www.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen 80;
server_name site.example.ru;
error_log /var/log/nginx/site.example.ru-err.log;
auth_basic "Frontend Security";
auth_basic_user_file ht/stie.example.ru.conf;
location / {
uwsgi_pass 127.0.0.1:49001;
include uwsgi_params;
}
location /media/ {
alias /var/www/django/code/site/media/;
expires 30d;
}
location /s/ {
alias /var/www/django/code/site/allstatic/;
expires 30d;
}
}
One way or another, you will have to configure DNS records for your two domains so that they point to your server. The option with BIND9 is really not very convenient. I don’t remember exactly, but it seems like you can put entries for your domains in the Yandex control panel. If not, then you can use the services of other DNS hostings.
The main task is to ping your server by domain names. (Just in case, it's worth mentioning that after changing DNS records, you need to wait a bit until it reaches your provider's servers. Usually within an hour or two. There are tools for monitoring the status of DNS records around the world. Usually records around the world have time to update in about Well
, on the server you can register your hostname (that is, the domain) for each vhost.
ps the whole process is weakly dependent on the OS or web server. But yes. Debian7+nginx is both more convenient and somehow nicer. Although they may not agree with me.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question