User:Simon/Trim4/prototypes/nginx configuration: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "nginx is a web server software that the bootleg library runs on. This configuration allows maximum uploads of 100mb: <pre> server { listen 80 default_server; listen [::]:80...")
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
=nginx configuration=
nginx is a web server software that the bootleg library runs on. This configuration allows maximum uploads of 100mb:
nginx is a web server software that the bootleg library runs on. This configuration allows maximum uploads of 100mb:


Line 23: Line 24:
}
}
</pre>
</pre>
=nginx service file=
To enable, start, stop, or check the status of the nginx web server, a service file is needed. To create one in a systemd Linux distribution, make this file:
<code>/lib/systemd/system/nginx.service</code>
with the following contents:
<pre>
# Stop dance for nginx
# =======================
#
# ExecStop sends SIGSTOP (graceful stop) to the nginx process.
# If, after 5s (--retry QUIT/5) nginx is still running, systemd takes control
# and sends SIGTERM (fast shutdown) to the main process.
# After another 5s (TimeoutStopSec=5), and if nginx is alive, systemd sends
# SIGKILL to all the remaining processes in the process group (KillMode=mixed).
#
# nginx signals reference doc:
# http://nginx.org/en/docs/control.html
#
[Unit]
Description=A high performance web server and a reverse proxy server
Documentation=man:nginx(8)
After=network.target nss-lookup.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid
TimeoutStopSec=5
KillMode=mixed
[Install]
WantedBy=multi-user.target
</pre>
==On Debian/Ubuntu/RHEL/CentOS Linux==
Use the following command:
<code># /etc/init.d/nginx restart</code>
OR
<code># /etc/init.d/nginx reload</code>
OR
<code># service nginx restart</code>
OR
<code># service nginx reload</code>
OR if you are using systemd based Linux distro:
<code>$ sudo systemctl restart nginx</code>
OR
<code>$ sudo systemctl reload nginx</code>
To view status:
<code># service nginx status</code>
OR
<code>$ sudo systemctl status nginx</code>
However, the recommend way is as follows. This should work with any Linux distributions or Unix-like operating systems:
<code># nginx -s reload</code>
OR
<code># /path/to/full/nginx -s reload</code>
==If nginx is compiled and installed from the source code==
If nginx binary is installed at /usr/local/nginx/sbin/nginx, enter:
<code># /usr/local/nginx/sbin/nginx -s reload</code>

Latest revision as of 18:27, 10 June 2020

nginx configuration

nginx is a web server software that the bootleg library runs on. This configuration allows maximum uploads of 100mb:

server {
 listen 80 default_server;
 listen [::]:80 default_server;
 server_name _;  
 location /bootleglibrary {

   auth_basic           "ヽ(°〇°)ノ";
   auth_basic_user_file /etc/nginx/htpasswd;

   client_max_body_size 100M;

   proxy_bind         $server_addr;
   proxy_pass         http://127.0.0.1:20190;
   proxy_set_header   Host                $http_host;
   proxy_set_header   X-Forwarded-For     $proxy_add_x_forwarded_for;
   proxy_set_header   X-Scheme            $scheme;
   proxy_set_header   X-Script-Name       /bootleglibrary;

   }
}

nginx service file

To enable, start, stop, or check the status of the nginx web server, a service file is needed. To create one in a systemd Linux distribution, make this file:

/lib/systemd/system/nginx.service

with the following contents:

# Stop dance for nginx
# =======================
#
# ExecStop sends SIGSTOP (graceful stop) to the nginx process.
# If, after 5s (--retry QUIT/5) nginx is still running, systemd takes control
# and sends SIGTERM (fast shutdown) to the main process.
# After another 5s (TimeoutStopSec=5), and if nginx is alive, systemd sends
# SIGKILL to all the remaining processes in the process group (KillMode=mixed).
#
# nginx signals reference doc:
# http://nginx.org/en/docs/control.html
#
[Unit]
Description=A high performance web server and a reverse proxy server
Documentation=man:nginx(8)
After=network.target nss-lookup.target

[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid
TimeoutStopSec=5
KillMode=mixed

[Install]
WantedBy=multi-user.target


On Debian/Ubuntu/RHEL/CentOS Linux

Use the following command: # /etc/init.d/nginx restart

OR

# /etc/init.d/nginx reload

OR

# service nginx restart

OR

# service nginx reload

OR if you are using systemd based Linux distro:

$ sudo systemctl restart nginx

OR

$ sudo systemctl reload nginx

To view status:

# service nginx status

OR

$ sudo systemctl status nginx

However, the recommend way is as follows. This should work with any Linux distributions or Unix-like operating systems:

# nginx -s reload

OR

# /path/to/full/nginx -s reload

If nginx is compiled and installed from the source code

If nginx binary is installed at /usr/local/nginx/sbin/nginx, enter:

# /usr/local/nginx/sbin/nginx -s reload