Server names are defined using the server_name directive and determine which server block is used for a given request. See also “How nginx processes a request”. They may be defined using exact names, wildcard names, or regular expressions:
In short & my opinion, server_name specify the domain this Nginx server would respond to request. You can't just copy and paste your domain name in the vHost without server_name directive )
Now there is problem with my nginx. Although nginx is installed. When I run: sudo systemctl restart nginx
It says:
mlopenedx@MillionEdx:~$ sudo systemctl 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.
mlopenedx@MillionEdx:~$ systemctl status Nginx -l
● Nginx.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
mlopenedx@MillionEdx:~$
Why is it saying nginx Not-Found. Do I need to re install or update nginx. What is this problem. Please guide me. Appreciate your help.
mlopenedx@MillionEdx:~$ sudo nginx -t
nginx: [warn] server name “/server/server-error.html” has suspicious symbols in /etc/nginx/sites-enabled/lms:17
nginx: [warn] server name “/server/server-error.html” has suspicious symbols in /etc/nginx/sites-enabled/lms:233
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
mlopenedx@MillionEdx:~$
Also when I see LMS17 & 233 the line in LMS It is:
Unix environments are always case-sensitive, distinguishing between capital letters and lower-case letters. Most software and directory names in a Unix environment are conventionally written in lower-case.
If you literally wrote systemctl status Nginx then you were referring to a nonexistent Nginx service which is different from the nginx service.
Even software that is written with a brand name with a capital letter, such as Certbot, is most often installed and referred to in lower-case in command lines, like certbot renew.
Hello schoen,
Thanks. But now I am not able to browse LMS on my IP address. It is giving error: 404 Not Found nginx
I saw error log file from : /var/log/nginx/error.log
It is as below:
2018/06/13 15:56:20 [emerg] 2394#2394: unknown directive "www.millionlightsdev.com" in /etc/nginx/sites-enabled/lms:12
2018/06/13 16:29:09 [warn] 34521#34521: server name "/server/server-error.html" has suspicious symbols in /etc/nginx/sites-enabled/lms:13
2018/06/13 16:30:25 [warn] 35298#35298: server name "/server/server-error.html" has suspicious symbols in /etc/nginx/sites-enabled/lms:13
2018/06/13 16:30:25 [notice] 35298#35298: signal process started
2018/06/13 16:30:25 [error] 35298#35298: invalid PID number "" in "/var/run/nginx.pid"
2018/06/13 16:30:25 [warn] 35299#35299: server name "/server/server-error.html" has suspicious symbols in /etc/nginx/sites-enabled/lms:13
2018/06/13 16:31:24 [warn] 36056#36056: server name "/server/server-error.html" has suspicious symbols in /etc/nginx/sites-enabled/lms:13
2018/06/13 16:31:24 [warn] 36056#36056: server name "/server/server-error.html" has suspicious symbols in /etc/nginx/sites-enabled/lms:226
2018/06/13 16:31:24 [notice] 36056#36056: signal process started
2018/06/13 17:21:30 [warn] 73552#73552: server name "/server/server-error.html" has suspicious symbols in /etc/nginx/sites-enabled/lms:17
2018/06/13 17:21:30 [warn] 73552#73552: server name "/server/server-error.html" has suspicious symbols in /etc/nginx/sites-enabled/lms:233
2018/06/13 17:21:30 [emerg] 73552#73552: bind() to 0.0.0.0:18100 failed (98: Address already in use)