ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

How to host erpnext in public domain


#1

i want brows this erpnext from other conputer.

  1. i have global IP and even i have link with sub-domain with global public IP.
  2. i edit the hosts file also ( ip domain name)

when i enter ip of erpnext server i can get nginx server page only, that i know nginx Apache server is working. BUT how i can get erpnext page.


#2

Did you reroute to the correct virtual host name and port?


#3

@trentmu, you mean in nginx/config.d directory?.. there i have done.

upstream erp-frappe {
server 127.0.0.1:8000 fail_timeout=0;
}

upstream erp-socketio-server {
server 127.0.0.1:9000 fail_timeout=0;
}

setup maps

server blocks

server {
listen 443;
server_name
erp-dev.example.com
;

root /home/kinl/erp/sites;




location /assets {
	try_files $uri =404;
}

location ~ ^/protected/(.*) {
	internal;
	try_files /$host/$1 =404;
}

location /socket.io {
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
	proxy_set_header X-Frappe-Site-Name $host;
	proxy_set_header Origin $scheme://$http_host;
	proxy_set_header Host $host;

	proxy_pass http://erp-socketio-server;
}

location / {
	try_files /$host/public/$uri @webserver;
}

location @webserver {
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header X-Forwarded-Proto $scheme;
	proxy_set_header X-Frappe-Site-Name $host;
	proxy_set_header Host $host;
	proxy_set_header X-Use-X-Accel-Redirect True;
	proxy_read_timeout 120;
	proxy_redirect off;

	proxy_pass  http://erp-frappe;
}

# error pages
error_page 502 /502.html;
location /502.html {
	root /home/kin/bench-repo/bench/config/templates;
	internal;
}

# optimizations
sendfile on;
keepalive_timeout 15;
client_max_body_size 50m;
client_body_buffer_size 16K;
client_header_buffer_size 1k;

# enable gzip compresion
# based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge
gzip on;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
	application/atom+xml
	application/javascript
	application/json
	application/rss+xml
	application/vnd.ms-fontobject
	application/x-font-ttf
	application/font-woff
	application/x-web-app-manifest+json
	application/xhtml+xml
	application/xml
	font/opentype
	image/svg+xml
	image/x-icon
	text/css
	text/plain
	text/x-component
	;
	# text/html is always compressed by HttpGzipModule

}


#4

On a production setup, you can change the port to your preference like this… (as user frappe)

cd ~/frappe-bench
bench set-nginx-port erp-dev.example.com 8120
#nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
bench setup nginx
sudo systemctl reload nginx

Then you would go to http://erp-dev.example.com:8120


#5

@trentmu, thanks for your reply. i put port 8080, but its not working. can’t brows from other computer.


#6

Port 8080 is normally the development system, which needs to get a

bench start


#7

@trentmu, even i change to 443. its not working


#8

Have you checked that there is nothing running on the default port 443?
You also need to open the port on your firewall.
I recommend changing to a non-standard port to ensure that there is no clash.

Maybe try setting it to 8443 or something simple to remember


#9

@trentmu and @rmehta, can help me to brows erpnext system from other out side computer. i can ping to my public ip and domain name, but can’t brows the erp system.
my hosts file:
local ip erpdev.example.com

nginx/conf.d/frappe-bench.conf file

upstream erp-frappe {
server 127.0.0.1:8000 fail_timeout=0;
}

upstream erp-socketio-server {
server 127.0.0.1:9000 fail_timeout=0;
}

server {
listen 8443;
server_name
erpdev.example.com
;

root /home/kin/erp/sites;

location /assets {
	try_files $uri =404;
}

location ~ ^/protected/(.*) {
	internal;
	try_files /erpdev.example.com/$1 =404;
}

location /socket.io {
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
	proxy_set_header X-Frappe-Site-Name erpdev.example.com;
	proxy_set_header Origin $scheme://$http_host;
	proxy_set_header Host $host;

	proxy_pass http://erp-socketio-server;
}

location / {
	try_files /erpdev.example.com/public/$uri @webserver;
}

location @webserver {
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header X-Forwarded-Proto $scheme;
	proxy_set_header X-Frappe-Site-Name erpdev.example.com;
	proxy_set_header Host $host;
	proxy_set_header X-Use-X-Accel-Redirect True;
	proxy_read_timeout 120;
	proxy_redirect off;

	proxy_pass  http://erp-frappe;
}

# error pages
error_page 502 /502.html;
location /502.html {
	root /home/kin/bench-repo/bench/config/templates;
	internal;
}

# optimizations
sendfile on;
keepalive_timeout 15;
client_max_body_size 50m;
client_body_buffer_size 16K;
client_header_buffer_size 1k;

# enable gzip compresion
# based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge
gzip on;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
	application/atom+xml
	application/javascript
	application/json
	application/rss+xml
	application/vnd.ms-fontobject
	application/x-font-ttf
	application/font-woff
	application/x-web-app-manifest+json
	application/xhtml+xml
	application/xml
	font/opentype
	image/svg+xml
	image/x-icon
	text/css
	text/plain
	text/x-component
	;
	# text/html is always compressed by HttpGzipModule

}


#10

If you have the IP and DNS set for erpdev.example.com, then this should work

cd ~/frappe-bench
bench set-nginx-port erpdev.example.com 8443
#nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
bench setup nginx
sudo systemctl reload nginx

Then http://erpdev.example.com:8443 should work.

Maybe check that everything is up and running

netstat -tnlp | grep -i listen


#11

@trentmu
when i run (bench set-nginx-port erpdev.example.com 8443) this command, my port is auto configure to 80. i don’t know why. and after that can’t run nginx.


#12

Can you run the command(s) and share the traceback/console screen?


#13

@trentmu, now when i run nginx it give this error:
Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.


#14

You’ll need to share/show those log files so that people can assist you