This repository has been archived by the owner on Sep 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
Nginx
Glenn Carremans edited this page Feb 22, 2018
·
4 revisions
Add the rewrite rules from nginx.example.conf to your server block
rewrite ^/raw_data$ /raw_data.php?$1 last;
rewrite ^/gym_data$ /gym_data.php?$1 last;
rewrite ^/motd_data$ /motd_data.php?$1 last;
rewrite ^/weather_data$ /weather_data.php?$1 last;
rewrite ^/serviceWorker.min.js$ /static/dist/js/serviceWorker.min.js last;
- Replace DOMAINNAME with your domain (ex. github.com)
- Replace /PATH/TO/PMSF to the location where your PMSF is installed (ex. /var/www/pmsf) 2 times
- Restart Nginx
- If you are using Ubuntu change
fastcgi_pass unix:/var/run/php-main.socket;
to one of these depending where your php_fpm is installed:fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
server {
listen 80;
server_name DOMAINNAME;
rewrite ^/raw_data$ /raw_data.php?$1 last;
rewrite ^/gym_data$ /gym_data.php?$1 last;
rewrite ^/motd_data$ /motd_data.php?$1 last;
rewrite ^/(.*)map.common.js$ /static/js/map.common.php last;
rewrite ^/weather_data$ /weather_data.php?$1 last;
#charset koi8-r;
error_log /var/log/nginx/error.log warn;
#access_log logs/host.access.log main;
location / {
include /etc/nginx/mime.types;
root /PATH/TO/PMSF;
index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
# redirect server error pages to the static page /50x.html
#
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /PATH/TO/PMSF;
try_files $uri =404;
fastcgi_pass unix:/var/run/php-main.socket;
fastcgi_index index.php;
fastcgi_param HTTP_IF_NONE_MATCH $http_if_none_match;
fastcgi_param HTTP_IF_MODIFIED_SINCE $http_if_modified_since;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}