install_nqinx_webserver_linux_ubuntu_server_20_04_lts
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
install_nqinx_webserver_linux_ubuntu_server_20_04_lts [2020/06/10 02:53] – [Installing Nginx Server] wikiadmin | install_nqinx_webserver_linux_ubuntu_server_20_04_lts [2020/06/10 04:42] (current) – [Configure PhpMyAdmin within Nginx Server default sites-available virtual host file] wikiadmin | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Install Nginx Webserver on Linux Ubuntu Server 20.04 LTS ====== | + | ====== Install Nginx Webserver on Linux Ubuntu Server 20.04 LTS (Changing from Apache2 already installed) |
- | < | + | It would be necessary to switch from Apache to Nginx if, for example, you want to install NextCloud and OnlyOffice Document Server on the same Ubuntu server and integrate them to work together in order to provide document creation, editing, collaboration, |
- | $ sudo apt upgrade </code> | + | |
- | Stop apache2 if that webserver is also installed and running. | + | < |
+ | sudo apt upgrade </ | ||
+ | |||
+ | Stop apache2 if that webserver is also installed and running. It may also be necessary to change the http Port bind to Apache2 before starting Nginx after it is installed. | ||
< | < | ||
+ | |||
+ | See below if you need to change http port 80 that is bind to Apache2. | ||
===== Installing Nginx Server ===== | ===== Installing Nginx Server ===== | ||
- | < | + | < |
After the installation is completed, start the Nginx service and enable it to launch every time at system boot. Check the status of Nginx. | After the installation is completed, start the Nginx service and enable it to launch every time at system boot. Check the status of Nginx. | ||
Line 26: | Line 30: | ||
< | < | ||
Jun 10 02:33:16 xsvr nginx[77940]: | Jun 10 02:33:16 xsvr nginx[77940]: | ||
+ | |||
Jun 10 02:33:16 xsvr nginx[77940]: | Jun 10 02:33:16 xsvr nginx[77940]: | ||
+ | |||
Jun 10 02:33:17 xsvr nginx[77940]: | Jun 10 02:33:17 xsvr nginx[77940]: | ||
+ | |||
Jun 10 02:33:17 xsvr nginx[77940]: | Jun 10 02:33:17 xsvr nginx[77940]: | ||
+ | |||
Jun 10 02:33:17 xsvr nginx[77940]: | Jun 10 02:33:17 xsvr nginx[77940]: | ||
+ | |||
Jun 10 02:33:17 xsvr nginx[77940]: | Jun 10 02:33:17 xsvr nginx[77940]: | ||
+ | |||
Jun 10 02:33:18 xsvr nginx[77940]: | Jun 10 02:33:18 xsvr nginx[77940]: | ||
Jun 10 02:33:18 xsvr systemd[1]: nginx.service: | Jun 10 02:33:18 xsvr systemd[1]: nginx.service: | ||
+ | |||
Jun 10 02:33:18 xsvr systemd[1]: nginx.service: | Jun 10 02:33:18 xsvr systemd[1]: nginx.service: | ||
+ | |||
Jun 10 02:33:18 xsvr systemd[1]: Failed to start A high performance web server and a reverse proxy server.</ | Jun 10 02:33:18 xsvr systemd[1]: Failed to start A high performance web server and a reverse proxy server.</ | ||
+ | |||
==== Change Apache2 Default Port to Custom Port on Ubuntu / Debian ==== | ==== Change Apache2 Default Port to Custom Port on Ubuntu / Debian ==== | ||
Line 57: | Line 70: | ||
Save and close the file. | Save and close the file. | ||
+ | |||
+ | If the ports.conf file also has the following, may need to change ssl port 443 to port 444 or something else. | ||
+ | |||
+ | < | ||
+ | < | ||
+ | Listen 443 | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | Listen 443 | ||
+ | </ | ||
+ | </ | ||
+ | |||
Additionally, | Additionally, | ||
Line 83: | Line 109: | ||
< | < | ||
+ | ==== Return (above) to Start Nginx, Enable it to start at start-up, and check its status ==== | ||
+ | |||
+ | < | ||
+ | sudo systemctl start nginx | ||
+ | |||
+ | sudo systemctl enable nginx | ||
+ | |||
+ | sudo systemctl status nginx | ||
+ | </ | ||
+ | |||
+ | ===== Open the UFW firewall for Nginx port 80 and 443 ===== | ||
+ | |||
+ | If you have enabled the uncomplicated firewall (ufw) on Ubuntu, then you will need to type the following ufw command to open TCP port number 80 and 443 for everyone. | ||
+ | |||
+ | < | ||
+ | sudo ufw allow 80/tcp comment ' | ||
+ | |||
+ | sudo ufw allow 443/tcp comment ' | ||
+ | </ | ||
+ | |||
+ | Verify port status it: | ||
+ | |||
+ | < | ||
+ | |||
+ | ===== Configure Nginx to Use the PHP Processor ===== | ||
+ | |||
+ | ===== Configure PhpMyAdmin within Nginx Server default sites-available virtual host file ===== | ||
+ | |||
+ | Now go to the '/ | ||
+ | |||
+ | < | ||
+ | cd / | ||
+ | |||
+ | sudo cp default default-original | ||
+ | |||
+ | sudo vim default | ||
+ | </ | ||
+ | |||
+ | Paste the following Nginx configuration for PHPMyAdmin inside the ' | ||
+ | |||
+ | < | ||
+ | location /phpmyadmin { | ||
+ | root / | ||
+ | index index.php; | ||
+ | try_files $uri $uri/ =404; | ||
+ | |||
+ | location ~ ^/ | ||
+ | deny all; | ||
+ | } | ||
+ | |||
+ | location ~ / | ||
+ | fastcgi_pass unix:/ | ||
+ | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
+ | include fastcgi_params; | ||
+ | include snippets/ | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Save and exit. | ||
+ | |||
+ | Test the nginx configuration and make sure there is no error, then restart the nginx service. | ||
+ | |||
+ | < | ||
+ | sudo nginx -t | ||
+ | |||
+ | sudo systemctl reload nginx | ||
+ | </ | ||
+ | |||
+ | And we've added the Nginx configuration for our phpMyAdmin installation, | ||
install_nqinx_webserver_linux_ubuntu_server_20_04_lts.1591757591.txt.gz · Last modified: 2020/06/10 02:53 by wikiadmin