nginx

location
" " - match start av url
" = " - match nøyaktig
" ~ " - case-sensetive regular expression match
" ~* " - case-insensetive regular expression match
" ^~ " - The carat followed by tilde sign is used to perform longest nonregular expression match against the requested URI. If the requested URI hits such a location block, no further matching will takes place.

Last ned arkiv, konfigurer, make og install.
Opprett også en servicefil for automatisk start.

Last ned arkiv: http://nginx.org/en/download.html
Liste over konfigurasjon: http://nginx.org/en/docs/configure.html

Går utifra at mappestrukturen ser sånn ut:

nginx-folder-structure

wget http://nginx.org/download/nginx-1.25.1.tar.gz

tar zxvf nginx-1.25.1.tar.gz

cd nginx-1.25.1

./configure --prefix=/opt/nginx/nginx1.25.1 \
  --error-log-path=/opt/nginx/log/main-error.log \
  --conf-path=/opt/nginx/configuration/nginx.conf \
  --pid-path=/opt/nginx/nginx.pid \
  --lock-path=/opt/nginx/nginx.lock \
  --user=nginx \
  --group=nginx \
  --with-threads \
  --with-file-aio \
  --with-http_ssl_module \
  --with-http_v2_module \
  --with-http_realip_module \
  --with-http_addition_module \
  --with-http_image_filter_module=dynamic \
  --with-http_sub_module \
  --with-http_dav_module \
  --with-http_mp4_module \
  --with-http_gunzip_module \
  --with-http_gzip_static_module \
  --with-http_auth_request_module \
  --with-http_random_index_module \
  --with-http_secure_link_module \
  --with-http_slice_module \
  --with-http_stub_status_module \
  --http-log-path=/opt/nginx/log/main-access.log \
  --http-client-body-temp-path=/opt/nginx/temp/clientbody/ \
  --http-proxy-temp-path=/opt/nginx/temp/proxy/ \
  --http-fastcgi-temp-path=/opt/nginx/temp/fastcgi/ \
  --http-uwsgi-temp-path=/opt/nginx/temp/uwsgi/ \
  --http-scgi-temp-path=/opt/nginx/temp/scgi/ \
  --with-mail=dynamic \
  --with-mail_ssl_module \
  --with-stream=dynamic \
  --with-stream_ssl_module \
  --with-stream_realip_module \
  --with-stream_ssl_preread_module \
  --with-compat \
  --with-pcre \
  --with-pcre-jit

make -j12

make install

/etc/systemd/system/nginx.service

[Unit]
Description=Nginx web & proxy server
After=syslog.target network.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/opt/nginx/nginx.pid
ExecStartPre=/opt/nginx/nginx -t -q
ExecStart=/opt/nginx/nginx
ExecReload=/opt/nginx/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target