JVital2013 / vitality-goes

Web App for showcasing Geostationary Weather Satellite Data
GNU General Public License v3.0
69 stars 6 forks source link

Nginx configuration help #69

Closed ImDroided closed 1 month ago

ImDroided commented 1 month ago

I was wondering if anyone has a working nginx config or can tell me if its even possible. The system already has nginx serving raspinoaa and I was hoping to not have to install apache and have configs in different places. I am getting 404 errors on links like http://192.168.1.31:81/Current-Weather except index.php which tells me I have lost signal. I believe this has to be a rewrite issue. port 81 is up and serving. Crazy part is I believe I have a cached version of the site on my laptop and I can still load all the current images but if I hit refresh I get a 404. I can go to index.php and click the browser refresh and no 404 it reloads fine I can also use the menu and click around to things like current weather which will load what I am believing is a cached version but with current images and current info. I know the site is serving because I can get info from the datahandler also if I just goto http://192.168.1.31:81/ it loads http://192.168.1.31:81/Current-Weather but upon a brower refresh its now 404. rant over. thanks for the help

`server { listen 81;

Enabling IPv6 support making the server accessible from the internet

listen [::]:81;

root /var/www/vitality-goes/; index index.php index.html index.htm index.nginx-debian.html; autoindex on;

server_name raspberry-noaa.localdomain;

location ~ .php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; } }`

ImDroided commented 1 month ago

I am going to close this as I found a working solution.

You can add this as a option in the setup instructions.

sudo nano /etc/nginx/sites-available/vitality-goes

copy the following and save

server {
  listen 81;
  # Enabling IPv6 support making the server accessible from the internet
  listen [::]:81;

  root /var/www/vitality-goes/;
  index index.php;
  autoindex on;

  server_name raspberry-noaa.localdomain;

  gzip on;
  gzip_vary on;
  gzip_min_length 1024;
  gzip_proxied expired no-cache no-store private auth;
  gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
  gzip_disable "MSIE [1-6]\.";

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

  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
  }
}

Now run sudo ln -s /etc/nginx/sites-available/vitality-goes /etc/nginx/sites-enabled/ sudo systemctl reload nginx sudo ufw allow 81