I'm no server guru so looking for some assistance. I am hosting a laravel project on a digital ocean droplet, and pointing a subdomain registered at godaddy to said droplet. The address bar is updating to display the server IP rather than the relevant domain when attempting to access the site.
The Domain is split into two parts with the base domain pointing to a wordpress server, and the myaccount subdomain pointing to a digital ocean droplet.
DNS records applied:
CNAME www -> @
A @ -> XX.XXX.XX.XXX
A subdomain -> 184.168.131.241
(automatically set by godaddy when setting forwarding rule to point
towards the server at 68.183.26.235, I'm guessing some internal forwarding address).
Server Configurations:
NGINX.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
client_max_body_size 120M;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
Sites Available: alphamark-client
(symlinked to sites-enabled)
server {
server_name subdomain.example.com;
root /var/www/alphamark-client/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/subdomain.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/subdomain.example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = subdomain.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name subdomain.example.com;
return 404; # managed by Certbot
}
Laravel Application Environment:
APP_NAME=AlphamarkClient
APP_ENV=production
APP_DEBUG=false
APP_URL=https://subdomain.example.com
When attempting to access the subdomain, the server can be accessed. However, the address bar updates to reflect the server IP. This also breaks the ssl certificate do to it being registered to the subdomain. Any help with identifying which part of my setup is causing this behavior would be greatly appreciated.