208.4. Implementing Nginx as a web server and a reverse proxy

208.4 Implementing Nginx as a web server and a reverse proxy

Weight: 2
Description: Candidates should be able to install and configure a reverse proxy server, Nginx. Basic configuration of Nginx as a HTTP server is included.
Key Knowledge Areas:
    Nginx
    Reverse Proxy
    Basic Web Server
Terms and Utilities:
    /etc/nginx/
    nginx

Whats is nginx ?

NGINX (short forEngine X) is a free, open-source and powerful HTTP web server and reverse proxy with an event-driven (asynchronous) architecture. It is written using C programming language and runs on Unix-like operating systems as well as Windows OS.
It also works as a reverse proxy, standard mail and TCP/UDP proxy server, and can additionally be configured as a load balancer. It is powering many sites on the web. well known for its high-performance, stability and feature-rich set.

history

In 2002, Igor Sysoev start work on Nginx as a solution provider to the C10K problem, which was a extreme challenge for web servers to start handling ten thousand synchronized connections as a necessity for the modern network. The first public release of Nginx was made in 2004, meeting this goal by relying on an asynchronous, events-driven architecture.

nginx vs apache

Apache and Nginx both are the most common open source web servers. Together, both web servers are responsible for serving over 50% of traffic on the internet. Both solutions are capable of handling different workloads and working with other software to provide a full web stack.
While Apache and Nginx split many qualities, they should not be consideration of as completely interchangeable. Each has been developed in its own way and it is important to understand the situations where we may need to re-evaluate ourweb server of choices. This table will show how each web server stacks up in various areas:
Criterian
Apache
Nginx
Static speed
Second to nginx
2.5x faster than apache
Dynamic speed
Both same in this area
Both same in this area
OS support
Unix, Windows, Mac OSX
works great with Unix-like OS. Not so with windows.
Security
Both have excellent security track record
Both have excellent security track record
Flexibility
Highly customizable architecture
Difficult to customize modules for the server due to complex base architecture
Support
Excellent community with wide spread user base.Lots of online support
provide community support through mailing lists, IRC , ...
Cost
Open source hence free to download and support
Open source license available along with paid liencese for advanced features like NGINX plus
Comparing and getting deeper to nginx features is beyond the scope of this lesson but it is recommanded to invest some time on it.
In this course we will stablish a basic web server using nginx and then implement a revere proxy using that.

Basic Web server

Lets start by installing Nginx web server from Ubuntu official repositories:
1
[email protected]:~# apt install nginx
Copied!
1
[email protected]:~# systemctl status nginx.service
2
● nginx.service - A high performance web server and a reverse proxy server
3
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en
4
Active: active (running) since Sat 2018-06-30 03:17:30 PDT; 2min 7s ago
5
Main PID: 3525 (nginx)
6
CGroup: /system.slice/nginx.service
7
├─3525 nginx: master process /usr/sbin/nginx -g daemon on; master_pro
8
└─3526 nginx: worker process
9
10
Jun 30 03:17:30 server1 systemd[1]: Starting A high performance web server and a
11
Jun 30 03:17:30 server1 systemd[1]: Started A high performance web server and a
12
[email protected]:~# netstat -tlpen
13
Active Internet connections (only servers)
14
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
15
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN 0 20730 1120/dnsmasq
16
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 0 38875 3375/cupsd
17
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 39652 3525/nginx -g daemo
18
tcp6 0 0 ::1:631 :::* LISTEN 0 38874 3375/cupsd
19
tcp6 0 0 :::80 :::* LISTEN 0 39653 3525/nginx -g daemo
Copied!

/etc/nginx/

All NGINX configuration files are located in the /etc/nginx/ directory.
1
[email protected]:~# cd /etc/nginx/
2
[email protected]:/etc/nginx# ls -l
3
total 56
4
drwxr-xr-x 2 root root 4096 Jul 12 2017 conf.d
5
-rw-r--r-- 1 root root 1077 Feb 11 2017 fastcgi.conf
6
-rw-r--r-- 1 root root 1007 Feb 11 2017 fastcgi_params
7
-rw-r--r-- 1 root root 2837 Feb 11 2017 koi-utf
8
-rw-r--r-- 1 root root 2223 Feb 11 2017 koi-win
9
-rw-r--r-- 1 root root 3957 Feb 11 2017 mime.types
10
-rw-r--r-- 1 root root 1462 Feb 11 2017 nginx.conf
11
-rw-r--r-- 1 root root 180 Feb 11 2017 proxy_params
12
-rw-r--r-- 1 root root 636 Feb 11 2017 scgi_params
13
drwxr-xr-x 2 root root 4096 Jun 30 03:17 sites-available
14
drwxr-xr-x 2 root root 4096 Jun 30 03:17 sites-enabled
15
drwxr-xr-x 2 root root 4096 Jun 30 03:17 snippets
16
-rw-r--r-- 1 root root 664 Feb 11 2017 uwsgi_params
17
-rw-r--r-- 1 root root 3071 Feb 11 2017 win-utf
Copied!
The primary configuration file is /etc/nginx/nginx.conf:
1
[email protected]:/etc/nginx# cat nginx.conf
2
user www-data;
3
worker_processes auto;
4
pid /run/nginx.pid;
5
6
events {
7
worker_connections 768;
8
# multi_accept on;
9
}
10
11
http {
12
13
##
14
# Basic Settings
15
##
16
17
sendfile on;
18
tcp_nopush on;
19
tcp_nodelay on;
20
keepalive_timeout 65;
21
types_hash_max_size 2048;
22
# server_tokens off;
23
24
# server_names_hash_bucket_size 64;
25
# server_name_in_redirect off;
26
27
include /etc/nginx/mime.types;
28
default_type application/octet-stream;
29
30
##
31
# SSL Settings
32
##
33
34
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
35
ssl_prefer_server_ciphers on;
36
37
##
38
# Logging Settings
39
##
40
41
access_log /var/log/nginx/access.log;
42
error_log /var/log/nginx/error.log;
43
44
##
45
# Gzip Settings
46
##
47
48
gzip on;
49
gzip_disable "msie6";
50
51
# gzip_vary on;
52
# gzip_proxied any;
53
# gzip_comp_level 6;
54
# gzip_buffers 16 8k;
55
# gzip_http_version 1.1;
56
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
57
58
##
59
# Virtual Host Configs
60
##
61
62
include /etc/nginx/conf.d/*.conf;
63
include /etc/nginx/sites-enabled/*;
64
}
65
66
67
#mail {
68
# # See sample authentication script at:
69
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
70
#
71
# # auth_http localhost/auth.php;
72
# # pop3_capabilities "TOP" "USER";
73
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
74
#
75
# server {
76
# listen localhost:110;
77
# protocol pop3;
78
# proxy on;
79
# }
80
#
81
# server {
82
# listen localhost:143;
83
# protocol imap;
84
# proxy on;
85
# }
86
#}
Copied!
In CentOS the configuration file would be like this:
1
[[email protected] nginx]# cat nginx.conf
2
# For more information on configuration, see:
3
# * Official English Documentation: http://nginx.org/en/docs/
4
# * Official Russian Documentation: http://nginx.org/ru/docs/
5
6
user nginx;
7
worker_processes auto;
8
error_log /var/log/nginx/error.log;
9
pid /run/nginx.pid;
10
11
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
12
include /usr/share/nginx/modules/*.conf;
13
14
events {
15
worker_connections 1024;
16
}
17
18
http {
19
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
20
'$status $body_bytes_sent "$http_referer" '
21
'"$http_user_agent" "$http_x_forwarded_for"';
22
23
access_log /var/log/nginx/access.log main;
24
25
sendfile on;
26
tcp_nopush on;
27
tcp_nodelay on;
28
keepalive_timeout 65;
29
types_hash_max_size 2048;
30
31
include /etc/nginx/mime.types;
32
default_type application/octet-stream;
33
34
# Load modular configuration files from the /etc/nginx/conf.d directory.
35
# See http://nginx.org/en/docs/ngx_core_module.html#include
36
# for more information.
37
include /etc/nginx/conf.d/*.conf;
38
39
server {
40
listen 80 default_server;
41
listen [::]:80 default_server;
42
server_name _;
43
root /usr/share/nginx/html;
44
45
# Load configuration files for the default server block.
46
include /etc/nginx/default.d/*.conf;
47
48
location / {
49
}
50
51
error_page 404 /404.html;
52
location = /40x.html {
53
}
54
55
error_page 500 502 503 504 /50x.html;
56
location = /50x.html {
57
}
58
}
59
60
# Settings for a TLS enabled server.
61
#
62
# server {
63
# listen 443 ssl http2 default_server;
64
# listen [::]:443 ssl http2 default_server;
65
# server_name _;
66
# root /usr/share/nginx/html;
67
#
68
# ssl_certificate "/etc/pki/nginx/server.crt";
69
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
70
# ssl_session_cache shared:SSL:1m;
71
# ssl_session_timeout 10m;
72
# ssl_ciphers HIGH:!aNULL:!MD5;
73
# ssl_prefer_server_ciphers on;
74
#
75
# # Load configuration files for the default server block.
76
# include /etc/nginx/default.d/*.conf;
77
#
78
# location / {
79
# }
80
#
81
# error_page 404 /404.html;
82
# location = /40x.html {
83
# }
84
#
85
# error_page 500 502 503 504 /50x.html;
86
# location = /50x.html {
87
# }
88
# }
89
90
}
Copied!
Configuration options in NGINX are called directives. Directives are organized into groups known as blocks (or contexts,They are synonymous)
Lines preceded by a # character are comments and not interpreted by NGINX. Lines containing directives must end with a ; or NGINX will fail to load the configuration and report an error.
The file starts with 5 irectives:user,worker_processes,error_log, andpid. These are outside any specific block or context, so they’re said to exist in themaincontext. See the NGINX docs for explanations of these directives and others available in the maincontext.
Theeventsandhttpblocks are areas for additional directives, and they also exist in themaincontext.
    The http Block :The http block contains directives for handling web traffic. These directives are often referred to as universal because they are passed on to to all website configurations NGINX serves.See the NGINX docs for a list of available directives for the http block.
    Server Blocks : Thehttpblock above contains anincludedirective which tells NGINX where website Configuration files are located.
If we installed from the official NGINX repository, or RedHat, this line will sayinclude /etc/nginx/conf.d/*.conf;as it does in thehttpblock above. Each website we host with NGINX should have its own configuration file inetc/nginx/conf.d/, with the name formatted asexample.com.conf. Sites which are disabled (not being served by NGINX) should be named xample.com.conf.disabled.
If we installed NGINX from the Debian or Ubuntu repositories, this line will sayinclude /etc/nginx/sites-enabled/*;. The../sites-enabled/folder contains symlinks to the site configuration files stored in/etc/nginx/sites-available/. Sites insites-availablecan be disabled by removing the symlink tosites-enabled.
1
[email protected]:/etc/nginx# cd sites-enabled/
2
[email protected]:/etc/nginx/sites-enabled# ls -l
3
total 0
4
lrwxrwxrwx 1 root root 34 Jun 30 03:17 default -> /etc/nginx/sites-available/default
5
6
[email protected]:/etc/nginx/sites-enabled# cd ../sites-available/
7
[email protected]:/etc/nginx/sites-available# ls -l
8
total 4
9
-rw-r--r-- 1 root root 2074 Feb 11 2017 default
10
11
[email protected]:/etc/nginx/sites-available# cat default
12
##
13
# You should look at the following URL's in order to grasp a solid understanding
14
# of Nginx configuration files in order to fully unleash the power of Nginx.
15
# http://wiki.nginx.org/Pitfalls
16
# http://wiki.nginx.org/QuickStart
17
# http://wiki.nginx.org/Configuration
18
#
19
# Generally, you will want to move this file somewhere, and start with a clean
20
# file but keep this around for reference. Or just disable in sites-enabled.
21
#
22
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
23
##
24
25
# Default server configuration
26
#
27
server {
28
listen 80 default_server;
29
listen [::]:80 default_server;
30
31
# SSL configuration
32
#
33
# listen 443 ssl default_server;
34
# listen [::]:443 ssl default_server;
35
#
36
# Note: You should disable gzip for SSL traffic.
37
# See: https://bugs.debian.org/773332
38
#
39
# Read up on ssl_ciphers to ensure a secure configuration.
40
# See: https://bugs.debian.org/765782
41
#
42
# Self signed certs generated by the ssl-cert package
43
# Don't use them in a production server!
44
#
45
# include snippets/snakeoil.conf;
46
47
root /var/www/html;
48
49
# Add index.php to the list if you are using PHP
50
index index.html index.htm index.nginx-debian.html;
51
52
server_name _;
53
54
location / {
55
# First attempt to serve request as file, then
56
# as directory, then fall back to displaying a 404.
57
try_files $uri $uri/ =404;
58
}
59
60
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
61
#
62
#location ~ \.php$ {
63
# include snippets/fastcgi-php.conf;
64
#
65
# # With php7.0-cgi alone:
66
# fastcgi_pass 127.0.0.1:9000;
67
# # With php7.0-fpm:
68
# fastcgi_pass unix:/run/php/php7.0-fpm.sock;
69
#}
70
71
# deny access to .htaccess files, if Apache's document root
72
# concurs with nginx's one
73
#
74
#location ~ /\.ht {
75
# deny all;
76
#}
77
}
78
79
80
# Virtual Host configuration for example.com
81
#
82
# You can move that to a different file under sites-available/ and symlink that
83
# to sites-enabled/ to enable it.
84
#
85
#server {
86
# listen 80;
87
# listen [::]:80;
88
#
89
# server_name example.com;
90
#
91
# root /var/www/example.com;
92
# index index.html;
93
#
94
# location / {
95
# try_files $uri $uri/ =404;
96
# }
97
#}
Copied!
Regardless of the installation source, server configuration files will contain asserverblock (or blocks) for a website.
    Listening ports : The listendirective tells NGINX the hostname/IP and the TCP port where it should listen for HTTP connections. The argument default_server means this virtual host will answer requests on port 80 that don’t specifically match another virtual host’s listen statement. The second statement listens over IPv6 and behaves similarly.
    Name-based virtual Hosting : The server_name directive allows multiple domains to be served from a single IP address. The server decides which domain to serve based on the request header it receives.
1
#examples:
2
#process requests for two addresses:
3
serve_name example.com www.example.com;
4
# using wildcrads
5
server_name *.example.com;
6
server_name .example.com;
7
#Process requests for all domain names beginning with example.
8
server_name example.*;
Copied!
NGINX allows us to specify server names that are not valid domain names. NGINX uses the name from the HTTP header to answer requests, regardless of whether the domain name is valid or not.
Using non-domain hostnames is useful if our server is on a LAN, or if we already know all of the clients that will be making requests of the server.
    Location Blocks : The locationsetting lets we configure how NGINX will respond to requests for resources within the server. Just like the server_namedirective tells NGINX how to process requests for the domain, locationdirectives cover requests for specific files and folders, such as http://example.com/blog/. locationalso supports regular expressions:
1
~* : matches to be case-insensitive
2
^~ :tells NGINX, if it matches a particular string, to stop searching for more specific matches and use the directives here instead. Other than that, these directives work like the literal string matches in the first group. Even if there’s a more specific match later, if a request matches one of these directives, the settings here will be used. See below for more information about the order and priority of location directive processing.
3
= : this forces an exact match with the path requested and then stops searching for more specific matches.
Copied!
    Location Root and Index: Thelocationsetting is another variable that has its own block of arguments.
    Once NGINX has determined whichlocationdirective best matches a given request, the response to this request is determined by the contents of the associatedlocationdirective block. Here’s an example:
1
location / {
2
root html;
3
index index.html index.htm;
4
}
Copied!
In this example, the document root is located in thehtml/directory. Under the default installation prefix for NGINX, the full path to this location is/etc/nginx/html/.Theindexvariable tells NGINX which file to serve if none is specified.

/usr/share/ngnix/html

The default public web root in NGNIX is /usr/share/ngnix/html how ever, here in ubuntu16.04 the default web root is:
1
[email protected]:/etc/nginx/sites-available# cat default | grep root
2
root /var/www/html;
3
# deny access to .htaccess files, if Apache's document root
4
# root /var/www/example.com;
5
[email protected]:/etc/nginx/sites-available# cd /var/www/html/
6
[email protected]:/var/www/html# ls -l
7
total 4
8
-rw-r--r-- 1 root root 612 Jun 30 03:17 index.nginx-debian.html
Copied!
Lets create ourselves index.html :
1
[email protected]:/var/www/html# mv index.nginx-debian.html index.nginx-debian.bak
2
[email protected]:/var/www/html# vim index.html
3
[email protected]:/var/www/html# cat index.html
4
<h1> example site powered by NGINX ! </h1>
5
[email protected]:/var/www/html# systemctl restart nginx.service
Copied!
and lets chek the results:
1
[email protected]:/var/www/html# telnet localhost 80
2
Trying 127.0.0.1...
3
Connected to localhost.
4
Escape character is '^]'.
5
GET /index.html
6
<h1> example site powered by NGINX ! </h1>
7
Connection closed by foreign host.
Copied!

nginx command

nginx deamon has a handy command tool nginxwhich can help us save more time, see some of switches:
1
[email protected]:~# nginx -?
2
nginx version: nginx/1.10.3 (Ubuntu)
3
Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]
4
5
Options:
6
-?,-h : this help
7
-v : show version and exit
8
-V : show version and configure options then exit
9
-t : test configuration and exit
10
-T : test configuration, dump it and exit
11
-q : suppress non-error messages during configuration testing
12
-s signal : send signal to a master process: stop, quit, reopen, reload
13
stop — shut down quickly
14
quit — shut down gracefully
15
reload — reload configuration, start the new worker process with a new configuration, gracefully shut down old worker processes.
16
reopen — reopen log files
17
-p prefix : set prefix path (default: /usr/share/nginx/)
18
-c filename : set configuration file (default: /etc/nginx/nginx.conf)
19
-g directives : set global directives out of configuration file
Copied!

Reverse Proxy

ngnix can be configured to works as a Reversy Proxy. It seats some where between client and web server and can do caching, loadbalancing, acceleration, client Authentication, bandwidth management and etc.
The most significant beneit of using proxies in our networks is server abstaraction. Becuase the client sees the proxy and not the actual server itself. From other side, when the server respond to the client request,it responds to the proxy , which respond to the client. This way we have added an abstaraction layer between client and the server. Client just sees the proxy server and doesn't have any idea about server configuration and on the other hand server is protected from evil hackers.
Working as a ReverseProxy is what ngnix is famous for and configuring it is so simple.It is configured as like as a virtual host.So lets start, we use Ubuntu and use previous basic web server. we have setup to proxy example.com:
1
[email protected]:~# vim /etc/hosts
2
[email protected]:~# cat /etc/hosts
3
127.0.0.1 localhost
4
127.0.1.1 ubuntu
5
127.0.0.1 example.com
6
# The following lines are desirable for IPv6 capable hosts
7
::1 ip6-localhost ip6-loopback
8
fe00::0 ip6-localnet
9
ff00::0 ip6-mcastprefix
10
ff02::1 ip6-allnodes
11
ff02::2 ip6-allrouters
12
[email protected]:~# ping example.com
13
PING example.com (127.0.0.1) 56(84) bytes of data.
14
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.017 ms
15
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.098 ms
16
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.076 ms
17
^C
18
--- example.com ping statistics ---
19
3 packets transmitted, 3 received, 0% packet loss, time 2034ms
20
rtt min/avg/max/mdev = 0.017/0.063/0.098/0.035 ms
Copied!
Now we want to proxy request for example.com to the google.com, for that we need some configurations.
1
[email protected]:~# cd /etc/nginx/
2
[email protected]:/etc/nginx# ls -l
3
total 56
4
drwxr-xr-x 2 root root 4096 Jul 12 2017 conf.d
5
-rw-r--r-- 1 root root 1077 Feb 11 2017 fastcgi.conf
6
-rw-r--r-- 1 root root 1007 Feb 11 2017 fastcgi_params
7
-rw-r--r-- 1 root root 2837 Feb 11 2017 koi-utf
8
-rw-r--r-- 1 root root 2223 Feb 11 2017 koi-win
9
-rw-r--r-- 1 root root 3957 Feb 11 2017 mime.types
10
-rw-r--r-- 1 root root 1462 Feb 11 2017 nginx.conf
11
-rw-r--r-- 1 root root 180 Feb 11 2017 proxy_params
12
-rw-r--r-- 1 root root 636 Feb 11 2017 scgi_params
13
drwxr-xr-x 2 root root 4096 Jul 1 22:33 sites-available
14
drwxr-xr-x 2 root root 4096 Jun 30 03:17 sites-enabled
15
drwxr-xr-x 2 root root 4096 Jun 30 03:17 snippets
16
-rw-r--r-- 1 root root 664 Feb 11 2017 uwsgi_params
17
-rw-r--r-- 1 root root 3071 Feb 11 2017 win-utf
Copied!
The simplest and minimal configuration which are requred for setting up a reverse proxy using nginx is inside proxy_param :
1
[email protected]:/etc/nginx# cat proxy_params
2
proxy_set_header Host $http_host;
3
proxy_set_header X-Real-IP $remote_addr;
4
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
5
proxy_set_header X-Forwarded-Proto $scheme;
Copied!
We need weather copy these configuration inside our virtual host or as we do here, include it.
1
[email protected]:/etc/nginx# cd sites-available/
2
[email protected]:/etc/nginx/sites-available# ls -l
3
total 4
4
-rw-r--r-- 1 root root 2074 Feb 11 2017 default
5
[email protected]:/etc/nginx/sites-available# vim example.com
6
[email protected]:/etc/nginx/sites-available# cat example.com
7
server {
8
listen 80;
9
server_name example.com;
10
11
location \ {
12
proxy_pass http://lxer.com/;
13
include /etc/nginx/proxy_params;
14
}
15
}
Copied!
Now lets make it enable and restart the nginx service:
1
[email protected]:/etc/nginx/sites-available# cd ../sites-enabled/
2
[email protected]:/etc/nginx/sites-enabled# ln -s ../sites-available/example.com .
3
[email protected]:/etc/nginx/sites-enabled# ls -l
4
total 0
5
lrwxrwxrwx 1 root root 34 Jun 30 03:17 default -> /etc/nginx/sites-available/default
6
lrwxrwxrwx 1 root root 30 Jul 1 22:48 example.com -> ../sites-available/example.com
7
8
[email protected]:/etc/nginx/sites-enabled# systemctl restart nginx.service
9
[email protected]:/etc/nginx/sites-enabled# systemctl status nginx.service
10
● nginx.service - A high performance web server and a reverse proxy server
11
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
12
Active: active (running) since Sun 2018-07-01 22:52:04 PDT; 8s ago
13
Process: 6867 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
14
Process: 6937 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
15
Process: 6935 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
16
Main PID: 6940 (nginx)
17
CGroup: /system.slice/nginx.service
18
├─6940 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
19
└─6941 nginx: worker process
20
21
Jul 01 22:52:03 server1 systemd[1]: Starting A high performance web server and a reverse proxy server...
22
Jul 01 22:52:04 server1 systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
23
Jul 01 22:52:04 server1 systemd[1]: Started A high performance web server and a reverse proxy server.
Copied!
Now it is time to check the results:
1
[email protected]:/etc/nginx/sites-enabled# elinks http://example.com
Copied!
and see what will happend.
Last modified 2yr ago