Ubuntu 22.04 Nginx proxy server kurulumu ve ayarları

Öncelikle paket derleyicimizi güncelleyerek başlıyoruz.
sudo apt-get update -y
sudo apt-get upgrade -y

sonrasında ilgili paketleri kuruyoruz.
sudo apt-get install nginx -y
libnginx-mod-http-geoip2 nginx-common nginx-core nginx-proxy

sudo systemctl status nginx
● nginx - A high performance web, http and reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled;)
   Active: active (Nginx server running)

nano editörü ile default config file yada varsa sizin config dosyanız editliyoruz.

sudo nano /etc/nginx/sites-available/default

# example nginx reverse proxy mapping
# /etc/nginx/sites-available/default
location /examples {
  proxy_pass http://localhost:8080/examples;
}


nginx proxy header value set ediyoruz.


# example nginx reverse proxy config file
# /etc/nginx/sites-available/default
location /examples {
  proxy_pass http://localhost:8080/examples;
  proxy_buffering off;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-Host $host;
  proxy_set_header X-Forwarded-Port $server_port;
}

nginx servisini restart ediyoruz.

sudo systemctl restart nginx

http://localhost/examples -- proxies for --> http://localhost:8080/examples



Bir cevap yazın