R
R
Ruslan Absalyamov2018-08-04 20:23:27
Nginx
Ruslan Absalyamov, 2018-08-04 20:23:27

I don’t understand a little how to remove ports in a link with nginx?

I'm trying to go to latine.site but I have the main apache page there. I already stopped apache, but nothing helps.
I'm in /etc/nginx/sites-available/latina

server {
  listen 81;
  root /home/ruslan/Разработка/latina;
  index index.html index.htm index.php;

  server_name latina.site;

  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
  }



  location / {
    try_files $uri $uri/ =404;
    proxy_pass http://127.0.0.1:81;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  }
}

Without a proxy, it works normally at the link latina.site:81. But I need to open the site normally when linking latina.site.
In /etc/hosts
127.0.0.1       localhost
127.0.1.1       debian
127.0.0.1       latina.site

But I didn't understand how to be here. Now at port latina.site:81 gives 502 error

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Spiridonov, 2018-08-04
@rusline18

Is Apache needed at all? You can completely demolish it sudo apt purge apache2
In /etc/nginx/sites-available/latina should be listen 80;
server_name latina.site; replace with server_name latina.site www.latina.site; - sometimes browsers can be quite stubborn.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question