DAY 20 DevOps 100 days

I am getting this failing everytime with port is not listening on stapp02 even though I cvan curl to it and there is only one port listening when i run the grep command, I have ran this numerous times now and it always fails on this part any assistance would be great

?>[steve@stapp02 ~]sudo tee /etc/nginx/nginx.conf > /dev/null <<‘EOF’F’
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

sendfile on;
keepalive_timeout 65;

server {
    listen 8095;
    server_name stapp02;
    root /var/www/html;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/var/run/php-fpm/default.sock;
    }
}

}
EOF
[steve@stapp02 ~]$ sudo nginx -t
sudo systemctl restart nginx
sudo systemctl restart php-fpm
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[steve@stapp02 ~]$ curl http://localhost:8095/index.php
Welcome to xFusionCsudo rm -f /etc/nginx/nginx.conf.defaultm -f /etc/nginx/nginx.conf.default
grep -R “listen” /etc/nginx
/etc/nginx/nginx.conf: listen 8095;
[steve@stapp02 ~]$ exit
logout
Connection to stapp02 closed.
thor@jump-host ~$ curl http://stapp02:8095/index.php
Welcome to xFusionCorp Industries!thor@jump-host ~$

Refer to this doc for the solution, and see if it helps.

Thanks I will take a look, all that I can see that is different at the moment in is the nginx.conf that you have port;default_server. I will see what happens, its frustrating when you can see that it works and then it says its failed because nginix has the wrong port to listen. I have done this task around 6 times now and each one has failed on that !.

Hello,

even i am facing issue in day 20
i am getting this below error

404 Not Found

404 Not Found


nginx/1.20.1 getting below output i followed the the documentation you provided

Finally got it to work , do you know what my only change was, I used VI instead of nano for the final attempt, frustrating to say the least.