Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5956

Nginx Is Showing the Default Page Instead of the Django Application

$
0
0

I am hosting a django website on gunicorn/nginx with ubuntu 22.04. I am following below guide for configuration.it is still showing the default nginx site. (I know there are similar question and also the troubleshooting guide and potential reasons also given in the document i am following; I tried everything but could not solve the issue.

Infrastructure :

  1. ubuntu 22.04
  2. Hestial CP - Using for firewall instead using ufw (bcoz with Hestia default ufw is not installed)
  3. Postgres
  4. Django
  5. gunicorn/nginx

Followed all the steps and performed the verification at each stage the document suggest and its showing positive results. but when i am trying to access my site it is still showing the default nginx site.

Configuration:

  1. etc/nginx/sites-available/myproject
    server {        listen 80;        server_name example.com;         location = /favicon.ico { access_log off; log_not_found off; }        location /static/ {            root /home/myuser/main/myproject;        }        location / {            include proxy_params;            proxy_pass //unix:/run/gunicorn.sock;        }    }
  1. etc/systemd/system/gunicorn.service
    [Unit]    Description=gunicorn daemon    Requires=gunicorn.socket    After=network.target    [Service]    User=myuser    Group=www-data    WorkingDirectory=/home/myuser/main/myproject    ExecStart=/home/myuser/main/envProject/bin/gunicorn \              --access-logfile - \              --workers 3 \              --bind unix:/run/gunicorn.sock \              myproject.wsgi:application    [Install]    WantedBy=multi-user.target
  1. gunicorn.socket
    [Unit]    Description=gunicorn socket    [Socket]    ListenStream=/run/gunicorn.sock    [Install]    WantedBy=sockets.target
  1. Firewall (I have opened all major ports without ip restrictions, shall start closing once the setup works)enter image description here

PS: The strangest part is after activating virtual env and run manually command "gunicorn --bind 0.0.0.0:8000 myproject.wsgi" i am able to access myexample.com:8000

access log

103.241.224.248 - - [01/Jul/2023:06:02:49 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" "-"103.241.224.248 - - [01/Jul/2023:06:02:50 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" "-"103.241.224.248 - - [01/Jul/2023:06:08:24 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" "-"103.241.224.248 - - [01/Jul/2023:06:08:26 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" "-"103.241.224.248 - - [01/Jul/2023:06:08:26 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" "-"103.241.224.248 - - [01/Jul/2023:06:13:37 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" "-"103.241.224.248 - - [01/Jul/2023:06:33:57 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" "-"103.241.224.248 - - [01/Jul/2023:06:33:58 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" "-"103.241.224.248 - - [01/Jul/2023:06:35:32 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" "-"103.241.224.248 - - [01/Jul/2023:06:35:33 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" "-"103.241.224.248 - - [01/Jul/2023:06:36:31 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" "-"141.98.11.207 - - [01/Jul/2023:06:43:55 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46" "-"162.216.150.180 - - [01/Jul/2023:06:57:17 +0000] "GET / HTTP/1.1" 200 615 "-" "Expanse, a Palo Alto Networks company, searches across the global IPv4 space multiple times per day to identify customers' presences on the Internet. If you would like to be excluded from our scans, please send IP addresses/domains to: scaninfo@paloaltonetworks.com" "-"43.206.208.110 - - [01/Jul/2023:07:05:19 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5615.29 Safari/537.36" "-"83.97.73.89 - - [01/Jul/2023:07:05:39 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36" "-"117.235.235.145 - - [01/Jul/2023:07:08:58 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36" "-"173.201.180.210 - - [01/Jul/2023:07:22:19 +0000] "GET /wp-login.php HTTP/1.1" 404 153 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/95.0" "-"103.241.224.248 - - [01/Jul/2023:07:29:17 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" "-"103.241.224.248 - - [01/Jul/2023:07:29:20 +0000] "GET / HTTP/1.1" 200 615 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" "-"91.224.92.16 - - [01/Jul/2023:07:36:45 +0000] "GET / HTTP/1.1" 200 615 "-" "-" "-"

nginx error log:

2023/07/01 06:35:24 [notice] 21624#21624: signal 15 (SIGTERM) received from 27750, exiting2023/07/01 06:35:24 [notice] 21625#21625: exiting2023/07/01 06:35:24 [notice] 21625#21625: exit2023/07/01 06:35:24 [notice] 21624#21624: signal 15 (SIGTERM) received from 1, exiting2023/07/01 06:35:24 [notice] 21624#21624: signal 17 (SIGCHLD) received from 216252023/07/01 06:35:24 [notice] 21624#21624: worker process 21625 exited with code 02023/07/01 06:35:24 [notice] 21624#21624: exit2023/07/01 06:35:24 [notice] 27751#27751: using the "epoll" event method2023/07/01 06:35:24 [notice] 27751#27751: nginx/1.25.12023/07/01 06:35:24 [notice] 27751#27751: built by gcc 11.2.0 (Ubuntu 11.2.0-19ubuntu1) 2023/07/01 06:35:24 [notice] 27751#27751: OS: Linux 5.15.0-76-generic2023/07/01 06:35:24 [notice] 27751#27751: getrlimit(RLIMIT_NOFILE): 1024:5242882023/07/01 06:35:24 [notice] 27755#27755: start worker processes2023/07/01 06:35:24 [notice] 27755#27755: start worker process 277562023/07/01 07:22:19 [error] 27756#27756: *9 open() "/usr/share/nginx/html/wp-login.php" failed (2: No such file or directory), client: 173.201.180.210, server: localhost, request: "GET /wp-login.php HTTP/1.1", host: "arhamerp.com"2023/07/01 07:36:42 [notice] 27755#27755: signal 15 (SIGTERM) received from 40856, exiting2023/07/01 07:36:42 [notice] 27756#27756: signal 15 (SIGTERM) received from 1, exiting2023/07/01 07:36:42 [notice] 27756#27756: exiting2023/07/01 07:36:42 [notice] 27755#27755: signal 15 (SIGTERM) received from 1, exiting2023/07/01 07:36:42 [notice] 27756#27756: exit2023/07/01 07:36:43 [notice] 27755#27755: signal 17 (SIGCHLD) received from 277562023/07/01 07:36:43 [notice] 27755#27755: worker process 27756 exited with code 02023/07/01 07:36:43 [notice] 27755#27755: exit2023/07/01 07:36:43 [notice] 40857#40857: using the "epoll" event method2023/07/01 07:36:43 [notice] 40857#40857: nginx/1.25.12023/07/01 07:36:43 [notice] 40857#40857: built by gcc 11.2.0 (Ubuntu 11.2.0-19ubuntu1) 2023/07/01 07:36:43 [notice] 40857#40857: OS: Linux 5.15.0-76-generic2023/07/01 07:36:43 [notice] 40857#40857: getrlimit(RLIMIT_NOFILE): 1024:5242882023/07/01 07:36:43 [notice] 40859#40859: start worker processes2023/07/01 07:36:43 [notice] 40859#40859: start worker process 40860

enter image description herePlease help me understand the issue and the solution.

Thanks,A


Viewing all articles
Browse latest Browse all 5956

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>