Key Observations
- DNS Records :
- The
dig
output shows that bothshadharon.com
andfontspark.com
resolve to Cloudflare IPs (104.x.x.x
and172.x.x.x
), which indicates that Cloudflare is properly configured as a reverse proxy for these domains. - This means all traffic from visitors will first go through Cloudflare, and Cloudflare will forward it to your server’s IP (
8.222.140.244
).
- The
- Nginx Configuration :
- The symbolic links for
shadharon.com
,fontspark.com
, and other domains are correctly set up in/etc/nginx/sites-enabled/
. - Assuming the configuration files in
/etc/nginx/sites-available/
are correct, Nginx should now be able to handle requests for these domains.
- The symbolic links for
- Potential Issue :
- Despite the correct DNS and Nginx setup, if you’re still seeing unexpected behavior (e.g., redirects to
getimagedone.com
), the issue could be related to:- Misconfigured
server_name
directives in Nginx. - Incorrect WordPress database settings (
siteurl
andhome
). - A default server block in Nginx that is catching unmatched requests.
- Misconfigured
- Despite the correct DNS and Nginx setup, if you’re still seeing unexpected behavior (e.g., redirects to
Steps to Resolve
1. Verify server_name
Directives in Nginx
Ensure that each domain has its own unique server_name
directive in its respective Nginx configuration file. For example:
- For
shadharon.com
: nginx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
server {
listen 80;
server_name shadharon.com www.shadharon.com;
root /var/www/shadharon.com;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
For fontspark.com
:
nginx
- 1234567891011121314151617181920server {listen 80;server_name fontspark.com www.fontspark.com;root /var/www/fontspark.com;index index.php index.html index.htm;location / {try_files $uri $uri/ /index.php?$args;}location ~ \.php$ {include snippets/fastcgi-php.conf;fastcgi_pass unix:/run/php/php-fpm.sock;}location ~ /\.ht {deny all;}}
Double-check that the server_name
directives match the domain names exactly.
2. Check Default Server Block
If no matching server_name
is found, Nginx will fall back to the default server block . To prevent this, ensure that your Nginx configuration includes a default server block that explicitly denies unmatched requests. For example:
nginx
1
2
3
4
5
6
7
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 404; # Or redirect to a custom error page
}
This ensures that any request not matching a specific server_name
will result in a 404 error instead of being routed to another site.
3. Update WordPress Database Settings
WordPress itself may redirect requests based on the siteurl
and home
values stored in its database. Ensure these values are correct for each site:
- For
shadharon.com
: sql
1
2
UPDATE wp_options SET option_value = ‘http://shadharon.com’ WHERE option_name = ‘siteurl’;
UPDATE wp_options SET option_value = ‘http://shadharon.com’ WHERE option_name = ‘home’;
For fontspark.com
:
sql
- 12UPDATE wp_options SET option_value = ‘http://fontspark.com’ WHERE option_name = ‘siteurl’;UPDATE wp_options SET option_value = ‘http://fontspark.com’ WHERE option_name = ‘home’;
Replace http://
with https://
if you’re using HTTPS.
4. Clear Browser Cache
Browsers often cache redirects. Clear your browser cache or test the sites in an incognito/private window to ensure you’re seeing the latest changes.
5. Test Nginx Configuration
After making the above changes, test the Nginx configuration for syntax errors:
bash
1
sudo nginx -t
If there are no errors, reload Nginx:
bash
1
sudo systemctl reload nginx
6. Verify Logs
If the issue persists, check the Nginx error logs for clues:
bash
1
sudo tail -f /var/log/nginx/error.log
Look for any errors or warnings that might indicate why requests are being misrouted.
Summary
The DNS records for shadharon.com
and fontspark.com
are correctly pointing to Cloudflare, and the Nginx configuration files are now enabled. To resolve the issue:
- Verify that each domain has a unique
server_name
directive in its Nginx configuration. - Add a default server block to handle unmatched requests.
- Update the WordPress database settings (
siteurl
andhome
) for each site. - Clear your browser cache and test the sites again.
If you still encounter issues, please share the contents of your Nginx configuration files (e.g., /etc/nginx/sites-available/shadharon.com
) and any relevant error logs so I can assist further.