Before we begin, you will need to login to your server via SSH as user root:<\/p>\n
ssh root@IP_ADDRESS -p PORT_NUMBER<\/pre>\nand replace \u201cIP_ADDRESS\u201d and \u201cPORT_NUMBER\u201d with your actual server IP address and SSH port number.<\/p>\n
Let\u2019s also make sure that your Debian server is up-to-date by running the following command:<\/p>\n
apt-get update && sudo apt-get upgrade<\/pre>\nHere is a sample of the output you should get:<\/p>\n
Reading package lists... Done\r\nBuilding dependency tree\r\nReading state information... Done\r\nCalculating upgrade... Done\r\nThe following packages will be upgraded:\r\nlibperl5.24 perl perl-base perl-modules-5.24\r\n4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.\r\nNeed to get 7813 kB of archives.\r\nAfter this operation, 9216 B of additional disk space will be used.\r\nDo you want to continue? [Y\/n] Y\r\nGet:1 http:\/\/security.debian.org stretch\/updates\/main amd64 libperl5.24 amd64 5.24.1-3+deb9u3 [3527 kB]\r\nGet:2 http:\/\/security.debian.org stretch\/updates\/main amd64 perl amd64 5.24.1-3+deb9u3 [219 kB]\r\nGet:3 http:\/\/security.debian.org stretch\/updates\/main amd64 perl-base amd64 5.24.1-3+deb9u3 [1344 kB]\r\nGet:4 http:\/\/security.debian.org stretch\/updates\/main amd64 perl-modules-5.24 all 5.24.1-3+deb9u3 [2723 kB]\r\nFetched 7813 kB in 0s (12.0 MB\/s)\r\n(Reading database ... 36668 files and directories currently installed.)\r\nPreparing to unpack ...\/libperl5.24_5.24.1-3+deb9u3_amd64.deb ...\r\nUnpacking libperl5.24:amd64 (5.24.1-3+deb9u3) over (5.24.1-3+deb9u2) ...\r\nPreparing to unpack ...\/perl_5.24.1-3+deb9u3_amd64.deb ...\r\nUnpacking perl (5.24.1-3+deb9u3) over (5.24.1-3+deb9u2) ...\r\nPreparing to unpack ...\/perl-base_5.24.1-3+deb9u3_amd64.deb ...\r\nUnpacking perl-base (5.24.1-3+deb9u3) over (5.24.1-3+deb9u2) ...\r\nSetting up perl-base (5.24.1-3+deb9u3) ...\r\n(Reading database ... 36668 files and directories currently installed.)\r\nPreparing to unpack ...\/perl-modules-5.24_5.24.1-3+deb9u3_all.deb ...\r\nUnpacking perl-modules-5.24 (5.24.1-3+deb9u3) over (5.24.1-3+deb9u2) ...\r\nSetting up perl-modules-5.24 (5.24.1-3+deb9u3) ...\r\nSetting up libperl5.24:amd64 (5.24.1-3+deb9u3) ...\r\nSetting up perl (5.24.1-3+deb9u3) ...\r\nProcessing triggers for libc-bin (2.24-11+deb9u3) ...\r\nProcessing triggers for man-db (2.7.6.1-2) ...<\/pre>\n<\/span>2. Install Nginx on Debian 9<\/span><\/h2>\nYou can install Nginx from Debian package repository. Simply, run the following command to install Nginx on your server:<\/p>\n
apt-get install nginx<\/pre>\nYou will get the following output:<\/p>\n
Reading package lists... Done\r\nBuilding dependency tree\r\nReading state information... Done\r\nThe following additional packages will be installed:\r\nlibnginx-mod-http-auth-pam libnginx-mod-http-dav-ext libnginx-mod-http-echo libnginx-mod-http-geoip libnginx-mod-http-image-filter libnginx-mod-http-subs-filter\r\nlibnginx-mod-http-upstream-fair libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream nginx-common nginx-full\r\nSuggested packages:\r\nfcgiwrap nginx-doc\r\nThe following NEW packages will be installed:\r\nlibnginx-mod-http-auth-pam libnginx-mod-http-dav-ext libnginx-mod-http-echo libnginx-mod-http-geoip libnginx-mod-http-image-filter libnginx-mod-http-subs-filter\r\nlibnginx-mod-http-upstream-fair libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream nginx nginx-common nginx-full\r\n0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.\r\nNeed to get 0 B\/1585 kB of archives.\r\nAfter this operation, 2865 kB of additional disk space will be used.\r\nDo you want to continue? [Y\/n] y<\/pre>\nAfter the installation is completed Nginx will be started automatically.
\nTo verify that Nginx is really running on your server, you can also use the following command:<\/p>\n
systemctl status nginx<\/pre>\n\u25cf nginx.service - A high performance web server and a reverse proxy server\r\nLoaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; vendor preset: enabled)\r\nActive: active (running) since Sat 2018-04-14 11:44:12 CDT; 4min 10s ago\r\nDocs: man:nginx(8)\r\nProcess: 6412 ExecStart=\/usr\/sbin\/nginx -g daemon on; master_process on; (code=exited, status=0\/SUCCESS)\r\nProcess: 6409 ExecStartPre=\/usr\/sbin\/nginx -t -q -g daemon on; master_process on; (code=exited, status=0\/SUCCESS)\r\nMain PID: 6413 (nginx)\r\nCGroup: \/system.slice\/nginx.service\r\n\u251c\u25006413 nginx: master process \/usr\/sbin\/nginx -g daemon on; master_process on;\r\n\u251c\u25006414 nginx: worker process\r\n\u2514\u25006415 nginx: worker process<\/pre>\n