93
GustafB
7y

configuring nginx is like trying anal for the first time

Comments
  • 2
    Where do you struggle? Maybe i or we could help
  • 0
    If you need a server for a personal project, maybe caddy would be better for you.
  • 3
    @Alice yes it's easy
  • 4
    #config for webserver with no virtual hosts or for default server
    server {
    listen 80; #port config
    index index.php index.html index.htm; # what files act like index
    server_name _; #server name (url)
    root /var/www/html; # directory with files
    location / { # any route starting with /
    try_files $uri $uri/ =404; # tries to load file else bad gateway
    }
    }
    # config for virtual host web.name
    server {
    listen 80; #port config
    index index.php index.html index.htm; # what files act like index
    server_name web.name; #server name (url)
    root /var/www/html; # directory with files
    location / { # any route starting with /
    try_files $uri $uri/ =404; # tries to load file else bad gateway
    }
    }
  • 2
    @rootshell
    # simple reverse proxy for web.name
    server {
    listen 80; #port config
    server_name web.name; #server name (url)
    location / {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    # headers aren't needed but they pass the IP and hostname to the other servet
    proxy_pass http://localhost:8080; # sends all traffic to and dns/ip address on specified port.
    }
    }

    See. Unless you are doing some evil shit it's not that hard. 😁
  • 1
    Thanks, guys! Actually got it sorted out :)
  • 0
    that's pure gold right there
  • 5
    @urxvt not sure if about nginx or anal... 🤔
  • 2
    Awesome?
  • 1
    I have 3 tips for you:

    Heroku
  • 0
    @SSDD three. 👌
  • 0
    Being a manager is like ATM (ass to mouth).
Add Comment