Nginx Installation & Konfiguration: Unterschied zwischen den Versionen

Aus xinux.net
Zur Navigation springen Zur Suche springen
Zeile 15: Zeile 15:
  
 
*Ein Standard Beispiel für eine html Seite wäre
 
*Ein Standard Beispiel für eine html Seite wäre
 
+
<pre>
 
   <!doctype html>
 
   <!doctype html>
 
   <html>
 
   <html>
Zeile 27: Zeile 27:
 
   </body>
 
   </body>
 
   </html>
 
   </html>
 +
</pre>
  
 
=Kofiguration=
 
=Kofiguration=

Version vom 24. März 2020, 07:44 Uhr

Installation

  • sudo apt-get install nginx

localhost

Nginx.jpg

HTML Seite

  • Die Standard Seite befindet sich unter /var/www/html/
  • Erstelle einen neuen Ordner unter www
root@poppe:/# mkdir /var/www/zuxerBsp
root@poppe:/# cd /var/www/zuxerBsp/
root@poppe:/var/www/zuxerBsp# vi index.html
  • Ein Standard Beispiel für eine html Seite wäre
  <!doctype html>
  <html>
  <head>
    <meta charset="utf-8">
    <title>Hallo, Welt!</title>
   <h1>Hallo Welt</h1>
  </head>
  <body>
  Wir haben gerade erfolgreich unseren nginx Server aufgestellt!
  </body>
  </html>

Kofiguration

  • Zuerst wird die Konfigurationsdatei erstellt und anschließend bearbeitet
root@poppe:/etc/nginx/sites-available# touch zuxer.desanex.de.conf
root@poppe:/etc/nginx/sites-available# vi zuxer.desanex.de.conf

  • zuxer.desanex.de.conf
server {
      listen 80;
      listen [::]:80;
      server_name zuxer.desanex.de;
      root /var/www/zuxer.Bsp;
      index index.html;
      location / {
              try_files $uri $uri/ =404;
      }
}