start nginx

This commit is contained in:
Akshay Mankar 2023-06-06 06:19:10 +02:00
parent 5d27509f50
commit d683e6795b
Signed by: axeman
GPG key ID: CA08F3AB62369B89
2 changed files with 10 additions and 28 deletions

View file

@ -13,35 +13,11 @@ let
proxy_read_timeout = "120"; proxy_read_timeout = "120";
in in
writeText "erpnext.conf" '' writeText "erpnext.conf" ''
user nginx;
worker_processes auto;
error_log /tmp/erpnext/logs/nginx/error.log notice;
pid /tmp/erpnext/nginx.pid;
events { events {
worker_connections 1024; worker_connections 1024;
} }
http { http {
include ${nginx}/conf/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /tmp/erpnext/logs/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
upstream backend-server { upstream backend-server {
server ${backend} fail_timeout=0; server ${backend} fail_timeout=0;
} }
@ -103,7 +79,8 @@ http {
rewrite ^(.+)\.html$ $proxy_x_forwarded_proto://${frappe_site_name_header}$1 permanent; rewrite ^(.+)\.html$ $proxy_x_forwarded_proto://${frappe_site_name_header}$1 permanent;
location ~ ^/files/.*.(htm|html|svg|xml) { location ~ ^/files/.*.(htm|html|svg|xml) {
add_header Content-disposition "attachment"; # TODO: Figure out how to do this.
# add_header Content-disposition "attachment";
try_files /${frappe_site_name_header}/public/$uri @webserver; try_files /${frappe_site_name_header}/public/$uri @webserver;
} }

View file

@ -35,6 +35,9 @@
} { } {
guest.port = 9090; guest.port = 9090;
host.port = 9090; host.port = 9090;
} {
guest.port = 8081;
host.port = 8081;
}]; }];
}; };
@ -119,6 +122,11 @@
}; };
}; };
services.nginx = {
enable = true;
config = builtins.readFile "${pkgs.erpnext-nginx-conf}";
};
systemd.services.erpnext = systemd.services.erpnext =
let let
penv = pkgs.python3-erpnext.buildEnv.override { penv = pkgs.python3-erpnext.buildEnv.override {
@ -162,9 +170,6 @@
export PYTHON_PATH=${penv}/${pkgs.python3-erpnext.sitePackages} export PYTHON_PATH=${penv}/${pkgs.python3-erpnext.sitePackages}
export PATH="${pkgs.mariadb-client}/bin:${pkgs.nodejs}/bin:${penv}/bin:$PATH" export PATH="${pkgs.mariadb-client}/bin:${pkgs.nodejs}/bin:${penv}/bin:$PATH"
cat /etc/hosts
${pkgs.nettools}/bin/netstat -nptel
# Upstream initializes the DB with this command # Upstream initializes the DB with this command
# TODO: Make this idempotent # TODO: Make this idempotent
cd /var/lib/erpnext/bench/sites cd /var/lib/erpnext/bench/sites