G
G
gitdev2020-11-12 17:35:11
Nginx
gitdev, 2020-11-12 17:35:11

How to host a website on a specific port in Nginx?

server {
    server_name local.sitename;
   #какой порт указать в случае если нужно разместить два сайта
    listen 80;
    listen [::]:80;
    # remove trailing slash
    rewrite ^/(.*)/$ /$1 permanent;

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
ky0, 2020-11-12
@ky0

If you need to host two sites, make several server blocks with different server_names.

V
Vladimir Korotenko, 2020-11-12
@firedragon

By the way, I read the instructions, you just need to duplicate the directory several times
Listen 80
Listen 8070

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question