I have a subdomain in a cPanel where i added the ip of my Meteor app hosted on DigitalOcean.
The app works if accessed by www.subdomain.domain.com, but does NOT work if accessed without www.
How can i fix this issue?
I tried this solution , by editing nginx.conf, and adding the code at the end of the http {} part, but i am getting errors when doing service nginx restart.
server {
listen 80;
server_name example.com;
return 301 http://www.example.com$request_uri;
}
server {
listen 80;
server_name www.example.com;
}
Can you post your entire nginx site config? (e.g. the full contents of /etc/nginx/sites-enabled/default if you’re using the default site config file) Also, what errors are you seeing when you restart nginx?
Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.
Inside journalctl -xe i there are also some errors like this: Failed to start A high performance web server and a reverse proxy server.