Install Nginx and Setup

Hello,

Here is my nginx.conf file. I m not able to configure -
It is strange that I can’t stop nginx service by service or systemctl command.

Here is the screenshots. I moved nautilus.crt & nautilus.key files to those folder. I tried to link with /tmp folder and giving the owner ship, but no luck
image
image
image

Can anyone please help me.

Thanks

What is the line 67 in /etc/nginx/nginx.conf?

Another server configuration starts from there in nginx.conf file
the 1st server block & 2nd sever block are -

server {
     listen 80
     ....
}

server {
   listen 443 ssl 
   ....
}

Is it possible for you to share your task details. I think, in /etc/nginx/nginx.conf file, you have to change the listen port as asked in the task for the server and also specify the location for the root. Please try and let me know.

Hi,
https://www.server-world.info/en/note?os=CentOS_7&p=nginx&f=4
hope this will help you.

Here is the task -

On App Server X there is a self signed SSL certificate and key present at location /tmp/nautilus.crt and /tmp/nautilus.key. Move them to some appropriate location and deploy the same in Nginx.

Create an index.html file with content Welcome! under Nginx document root.

For final testing try to access the App Server 1 link (either hostname or IP) from jump host using curl command. For example curl -Ik https://<app-server-ip>/
  • I don’t know where to move the certificate & key file. So what I did is that
    • 1st configure in nginx.conf file to link/point the location of the file like ssl_certificate "/tmp/nautilus.crt" (That didn’t work. here I was getting error of not able to load crt, I change the ownership of the folder but this time it is able to load but not able to connect)
    • 2nd I moved those files to the mentioned location which is (by default) given in the nginx.config file. (That also didn’t work)
  • I guess as the task mentioned to access https://...., so I configured Listen port 443 for https section.
  • Default root location is already given in nginx.config file.(I didn’t change anything, though I tried & configure in the nginx.conf file a different location /var/www/; & put the index file there; that also didn’t work) . I just added the next line index index.html & created one index.html file there with the content.

I saw this, but didn’t work. :frowning: . I don’t know what the problem, I can’t stop the nginx server.

Hi,
when I got this task this link which i gave you worked fine

Hello,

Thanks. Somehow I managed to complete. I followed all my steps as I was doing only thing I didn’t do this time is - I didn’t start nginx service after installation. I configured all and then I started the nginx, and then it worked.

Not sure, why this behavior as after starting the nginx service, if there is anything thing missing or wrong. It was not stopped at all. I tried to kill the process as well. Even the configuration was right at the end, the right config file was not properly loaded.

hi royki,

I am getting an error message while editing the index.html.
any suggestions please. should I give any permissions to this file before editing?
the error says it is a linked file, i think it is pointing to …/…/doc/HTML/index.html file.



I am assuming these are the duplicate files created.


am I supposed to make changes to this file for below task?
Create an index.html file with content Welcome! under Nginx document root.

thanks and regards
Swaroop

@Inderpreet @vijin.palazhi @player001
please check and advise. I am hitting a deadline in 2 hours.

@swaroopcs88 That index.html seems to be a soft link. Unlink the same first then copy/create your own index.html file.



what is it I am missing? completed all four tasks.


connection refused. how to troubleshoot this issue?
also i have executed these commands to allow nginx traffic.

settings from sudo vi /etc/nginx/nginx.conf
image

You didn’t update server_name _; (update with server ip of the appserveror appserver name).

am I supposed to update it at 2 places? as I updated it under section 80.
ok I have updated it, still same message, connection refused.

getting this message now. is this the expected output?

No, Just update it in the section, where you made the configuration and you don’t need to configure all server section actually for this problem.
Other configurations are commented. If you change it, then you need to update; otherwise updating the mentioned section would be ok.

thank you @royki

I was able to finish the task successfully.
thanks for your help.
@Inderpreet thank you for helping me with symbolic link issue.
saved my 300 points. thanks again.
btw, restarting nginx service helped me in my last try.

one doubt. as it was pointing to port 443 when trying to curl -Ik https://172.16.238.10/.
am I supposed to update below section of nginx conf file to allow connection?


these lines were commented earlier.