Run two sites on the same server

Hi i created a new site and configure nginx on port 82 i want to open the first company with localhost:8000 and the second on localhost:82 i did those steps but it didn’t work any help?

1-Create a new site

bench new-site company.local

2-Set port

bench set-nginx-port company.local 82

3-Re generate nginx config

bench setup nginx

4-Reload nginx

sudo service nginx reload

2 Likes

please check inside /etc/nginx/conf.d and check if the nginx config file has been updated or not.

hi @koshish,
Inside /etc/nginx/conf.d i have nothing
What should i do?

sudo cp /home/frappe/frappe-bench/config/nginx.conf /etc/nginx/sites-available/default
sudo cp /home/frappe/frappe-bench/config/supervisor.conf /etc/supervisor/conf.d/supervisor.conf

if your user is frappe.

and after that
bench setup nginx
sudo service nginx reload
sudo service nginx restart

hi @adnan
i did the first command
sudo cp /home/frappe/frappe-bench/config/nginx.conf /etc/nginx/sites-available/default
but the second one isn’t available in this location no supervisor.conf file so didn’t do it
and i did the rest of the steps but still when i type in the URL: localhost:82 it doesn’t open.
Another thing is in this path /etc/nginx/conf.d there are no nginx config file.
any other fixes?

  1. Make sure Supervisor and Nginx are installed.

  2. bench set-nginx-port site2name port

sudo cp /home/frappe/frappe-bench/config/nginx.conf /etc/nginx/sites-available/default
sudo cp /home/frappe/frappe-bench/config/supervisor.conf /etc/supervisor/conf.d/supervisor.conf

if your user is frappe.

and after that
bench setup nginx
sudo service nginx reload
sudo service nginx restart

and the try the above commands again. hope this will help. i was stuck on this same issue 3 days ago… took 3 hours to make it working.

best of luck.

hi @adnan i have the developer mode i don’t have a supervisor.conf
what should i do?

open terminal run 1st site as normal : bench start
open another terminal and run 2nd site : bench --site {sitename} serve --port 8005

10 Likes

Thank you @Abbas_Ali_1460-FBAS

Welcome.

Thanks, for this clarification.

Thanks dear for quick response.

DNS based multitenancy is already done.

Is there any command to check if Multitenancy is on or off?

Please check my /etc/hosts

right now site1.example.com accisible at example.com