Well…
I have my domain primarysite.com of my droplet…i create a directory /livezilla/…
I want add a external subdomain to this directory:
I have in: /etc/nginx/sites-avaliable:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name http://primarysite.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?q=$uri&args;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
}
AND
server {
listen 80;
listen [::]:80;
server_name www.subdomain.external.com subdomain.external.com;
root /usr/share/nginx/html/livezilla/;
index index.php index.html index.htm;
}
After :
ln -s /etc/nginx/sites-available/subdomain.external.com /etc/nginx/sites-enabled/subdomain.external.com
and
ln -s /etc/nginx/sites-available/primarysite.com /etc/nginx/sites-enabled/primarysite.com
service nginx restart
[OK]…
but doens’t work…
Just primarysite.com works…
I forgot something?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
This solved my question. Wtf.
server {
listen subdomain.external.com:80;
server_name subdomain.external.com;
root /usr/share/nginx/html/livezilla;
index index.php index.html index.htm;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
}
primarysite.com (my droplet) ip eg: 1.2.3.4 subdomain.external.com ping directing to 1.2.3.4 (exactly the ip of my droplet)
but the subdomain.external.com is redirecting for 5.6.7.8. What’s happen?
subdomain.external.com redirecting to external.com… but with the ping it displays the correct ip of my droplet…
When you say it doesn’t work, what is the exact behavior you see? Is it redirecting back to the primary default or something else?