Ysurac / FlightAirMap

Open source project displaying live aircrafts, ships or trackers on 2D/3D map. Browse through the data based on a particular aircraft, airline, airport, tracker or vessel to search through the database or see extensive statistics. Can use ADS-B in SBS1 format (dump1090, Radarcape,...), VRS, VA (VATSIM, IVAO whazzup.txt, phpvms,...), ACARS (acarsdec, acarsdeco2), APRS, AIS as datasource.
https://www.flightairmap.com/
GNU Affero General Public License v3.0
523 stars 158 forks source link

nginx install - 403 errors #383

Open Taubin opened 6 years ago

Taubin commented 6 years ago

I'm attempting to install this behind NGINX and have run into a few issues. I have done a lot of searching and cannot figure out what's causing them. I already have NGINX and dump 1090 installed, with no problem.

I'm using a raspberry pi 3 for the host.

I've made sure all of the required packages are installed

sudo apt-get install php7.0-common php7.0-cgi php7.0-mysql php7.0-sqlite php7.0-curl php7.0 php7.0-xml php7.0-zip php7.0-gd php7.0-json
sudo apt-get install mysql-server mysql-client

I've cloned this repo into /var/www/html/flightairmap/

I've enabled it in sites-available

server {
        listen 80;
        listen [::]:80;

      #server_name localhost;
      root /var/www/html/flightairmap/;
        index index.html index.htm index.php;
      location ~ \.php$ {
           fastcgi_pass unix:/run/php-fpm.socket;
           fastcgi_index index.php;
           include /etc/nginx/fastcgi.conf;
           fastcgi_read_timeout 300;
      }
      include /var/www/html/flightairmap/install/flightairmap-nginx-conf.include;
}

And I've added a link to sites-enabled When I go to the address, I get a 403 error and I cannot figure out what's causing it, the error logs simply say forbidden:

2018/01/07 11:48:58 [error] 857#857: *14 directory index of "/var/www/html/flightairmap/install/" is forbidden, client: 192.168.0.44, server: _, request: "GET /flightairmap/install/ HTTP/1.1", host: "192.168.0.150"
2018/01/07 11:54:47 [error] 857#857: *34 directory index of "/var/www/html/flightairmap/install/" is forbidden, client: 192.168.0.44, server: _, request: "GET /flightairmap/install/ HTTP/1.1", host: "192.168.0.150"

I believe I have the permissions correct for the folder

$ ls -ll /var/www/html
total 32
drwxr-xr-x 16 www-data www-data 20480 Jan  7 11:14 flightairmap

I've tried reinstalling from scratch and have the same. I very much prefer nginx since it's what I'm used to and it's what I run on all of my servers. I'm sure it's just something dumb I've done, but any help would be greatly appreciated.

Ysurac commented 6 years ago

Did you do a chown -R ? what is the permissions for flightairmap/install folder ?

Taubin commented 6 years ago

I have, the permissions are 755:

drwxr-xr-x 8 www-data www-data 4096 Jan 7 11:14 install

Ysurac commented 6 years ago

php-fpm is configured and running ? What is the result of the url flightairmap/install/index.php ?

Taubin commented 6 years ago

fpm is running

 $ sudo systemctl status php7.0-fpm
● php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2018-01-08 07:40:09 NZDT; 23min ago
     Docs: man:php-fpm7.0(8)
 Main PID: 565 (php-fpm7.0)
   Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
      CPU: 308ms
   CGroup: /system.slice/php7.0-fpm.service
           ├─565 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)
           ├─910 php-fpm: pool www
           └─911 php-fpm: pool www

Jan 08 07:40:05 taubinpi systemd[1]: Starting The PHP 7.0 FastCGI Process Manager...
Jan 08 07:40:09 taubinpi systemd[1]: Started The PHP 7.0 FastCGI Process Manager.

Running flightairmap/install/index.php attempts to download the file instead of running it.

php configuration is attached php.ini.docx

Ysurac commented 6 years ago

I think you have an error in your nginx configuration. You use the server example I give with a server section but without server_name enabled. I think you already have an server section (or another site enabled). This can work with vhost, but not this way. What you seems to want is to enable FlightAirMap in a subdirectory. So you have to copy the location and the include part of this file in your already existing server section.