1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/linuxdash_ynh.git synced 2024-09-03 19:36:07 +02:00

Launch Linux-dash with python server.\n - Using proxy_pass nginx configuration.\n - Use supervisor package to daemonize Linux-Dash.

This commit is contained in:
Moul 2016-02-03 16:23:33 +01:00
parent f5d9fdb582
commit ae7f617c2a
4 changed files with 23 additions and 23 deletions

View file

@ -1,21 +1,6 @@
location YNH_WWW_PATH { location YNH_WWW_PATH/ {
alias YNH_WWW_ALIAS ; rewrite ^YNH_WWW_PATH$ YNH_WWW_PATH/ permanent;
proxy_pass http://localhost:8081/;
# Force https proxy_set_header Host $host;
if ($scheme = http) { proxy_buffering off;
rewrite ^ https://$server_name$request_uri? permanent;
}
index index.html index.htm index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
} }

5
conf/supervisor.conf Normal file
View file

@ -0,0 +1,5 @@
[program:linuxdash]
directory=/var/www/linuxdash/
command=python python-server.py
autostart=true
autorestart=true

View file

@ -20,9 +20,14 @@ sudo cp -a ../sources/* $final_path
# Set permissions # Set permissions
sudo chown -R www-data: $final_path sudo chown -R www-data: $final_path
# Set as a service with supervisor
sudo apt-get -y -qq install supervisor
sudo cp ../conf/supervisor.conf /etc/supervisor/conf.d/$app.conf
sudo supervisorctl update
sudo supervisorctl restart $app
# Modify Nginx configuration file and copy it to Nginx conf directory # Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
nginxconf=/etc/nginx/conf.d/$domain.d/$app.conf nginxconf=/etc/nginx/conf.d/$domain.d/$app.conf
sudo cp ../conf/nginx.conf $nginxconf sudo cp ../conf/nginx.conf $nginxconf
sudo chown root: $nginxconf sudo chown root: $nginxconf

View file

@ -1,10 +1,15 @@
#!/bin/bash #!/bin/bash
app=linuxdash
domain=$(sudo yunohost app setting linuxdash domain) domain=$(sudo yunohost app setting linuxdash domain)
# Remove sources and nginx configuration # Remove sources and nginx configuration
sudo rm -rf /var/www/linuxdash sudo rm -rf /var/www/$app
sudo rm -f /etc/nginx/conf.d/$domain.d/linuxdash.conf sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
# Remove service
sudo supervisorctl stop $app
sudo rm -f /etc/supervisor/conf.d/$app.conf
# Reload nginx configuration # Reload nginx configuration
sudo service nginx reload sudo service nginx reload