Nginx'te yeniyim ve alt alan adları almaya çalışıyorum. Ben yapmak istiyorum nenginx - iki alt etki alanı yapılandırması
alan adımı almak ve eklemek (haydi example.com
diyelim):
sub1.example.com
,sub2.example.com
ve ayrıcawww.example.com
mevcuttur.
Bunu Apache ile nasıl yapacağımı biliyorum, ancak Nginx gerçek kafa karıştırıcı oluyor.
Ben
Bulunduğum /etc/nginx/sites-enabled/example.com Debian 6. çalıştırıyorum:
server {
server_name www.example.com example.com;
access_log /srv/www/www.example.com/logs/access.log;
error_log /srv/www/www.example.com/logs/error.log;
root /srv/www/www.example.com/public_html;
location/{
index index.html index.htm;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/www.example.com/public_html$fastcgi_script_name;
}
}
example.com ve www.örnek hizmet için çalışıyor. com.
ben gibi aynı dosyada ikinci bir sunucu blok eklemek çalıştık:
server {
server_name www.example.com example.com;
access_log /srv/www/www.example.com/logs/access.log;
error_log /srv/www/www.example.com/logs/error.log;
root /srv/www/www.example.com/public_html;
server {
server_name sub1.example.com;
access_log /srv/www/example.com/logs/sub1-access.log;
error_log /srv/www/example.com/logs/sub1-error.log;
root /srv/www/example.com/sub1;
}
location/{
index index.html index.htm;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/www.example.com/public_html$fastcgi_script_name;
}
}
şansımız yok. Herhangi bir fikir? Herhangi bir geri bildirim için minnettar olurum.
Şundan bahsetmeliydim: Nihai hedef, sub1.example.com adresinin example.com/sub1 ve sub2.example.com adresine gitmek için example.com/sub2 adresine gitmesidir. Umarım bu mantıklıdır. – boredemt