{"id":1918,"date":"2018-12-18T03:34:06","date_gmt":"2018-12-18T03:34:06","guid":{"rendered":"https:\/\/www.hostnic.id\/blog\/?p=1918"},"modified":"2018-12-18T09:21:14","modified_gmt":"2018-12-18T09:21:14","slug":"cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl","status":"publish","type":"post","link":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/","title":{"rendered":"Cara Install Nginx dengan Virtual Hosts dan Certificate SSL"},"content":{"rendered":"<p>Nginx (singkatan dari Engine-x) adalah server HTTP dan reverse proxy yang bebas, open source, kuat, berkinerja tinggi, dan dapat diukur, email dan server proxy TCP \/ UDP standar. Nginx mudah digunakan dan dikonfigurasi, dengan bahasa konfigurasi yang sederhana. Nginx sekarang menjadi perangkat lunak server web yang lebih disukai untuk memberdayakan situs-situs yang sarat muatan, karena skalabilitas dan kinerjanya.<\/p>\n<p>Dalam artikel ini akan membahas cara menggunakan Nginx sebagai server HTTP, mengkonfigurasinya untuk melayani konten web, dan mengatur virtual host berbasis nama domain dan menginstal SSL, termasuk sertifikat yang ditandatangani sendiri di Ubuntu dan CentOS .<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_75 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Daftar Isi<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a0f4814573d0\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a0f4814573d0\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#Cara_Install_Nginx_Web_Server\" >Cara Install Nginx Web Server<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#Cara_Konfigurasi_Nginx_Web_Server\" >Cara Konfigurasi Nginx Web Server<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#How_to_Serve_Static_Content_Using_Nginx_in_Standalone_Mode\" >How to Serve Static Content Using Nginx in Standalone Mode<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#How_to_Restrict_Access_to_a_Web_Page_with_Nginx\" >How to Restrict Access to a Web Page with Nginx<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#How_to_Setup_Name-based_Virtual_hosts_Server_Blocks_in_Nginx\" >How to Setup Name-based Virtual hosts (Server Blocks) in Nginx<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#How_to_Install_and_Configure_SSL_with_Nginx\" >How to Install and Configure SSL with Nginx<\/a><ul class='ez-toc-list-level-5' ><li class='ez-toc-heading-level-5'><ul class='ez-toc-list-level-5' ><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#Summary\" >Summary<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Cara_Install_Nginx_Web_Server\"><\/span>Cara Install Nginx Web Server<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Pertama mulai dengan menginstal paket Nginx dari repositori resmi menggunakan manajer paket Anda seperti yang ditunjukkan.<\/p>\n<pre class=\"lang:default decode:true\">------------ On Ubuntu ------------ \r\n$ sudo apt update \r\n$ sudo apt install nginx \r\n\r\n------------ On CentOS ------------\r\n$ sudo yum update \r\n$ sudo yum install epel-release \r\n$ sudo yum install nginx<\/pre>\n<p>Setelah paket Nginx diinstal, Anda perlu memulai layanan, aktifkan untuk memulai secara otomatis saat boot dan lihat statusnya, menggunakan perintah berikut. Perhatikan bahwa di Ubuntu, harus dimulai dan diaktifkan secara otomatis saat paket sudah dikonfigurasikan sebelumnya.<\/p>\n<pre>$ sudo systemctl start nginx\r\n$ sudo systemctl enable nginx\r\n$ sudo systemctl status nginx\r\n<\/pre>\n<div id=\"attachment_30981\" class=\"wp-caption aligncenter\" style=\"width: 812px;\">\n<p><a href=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Start-and-Check-Nginx-Status.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30981\" style=\"display: inline;\" src=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Start-and-Check-Nginx-Status.png?resize=802%2C401&#038;ssl=1\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Start-and-Check-Nginx-Status.png 802w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Start-and-Check-Nginx-Status-768x384.png 768w\" alt=\"Start and Check Nginx Status\" width=\"802\" height=\"401\" data-lazy-loaded=\"true\" \/><noscript><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30981\" src=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Start-and-Check-Nginx-Status.png?resize=802%2C401&#038;ssl=1\" alt=\"Start and Check Nginx Status\" width=\"802\" height=\"401\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Start-and-Check-Nginx-Status.png 802w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Start-and-Check-Nginx-Status-768x384.png 768w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><\/noscript><\/a><\/p>\n<p class=\"wp-caption-text\">Start and Check Nginx Status<\/p>\n<\/div>\n<p>Pada titik ini, server web Nginx harus aktif dan berjalan, Anda dapat memverifikasi status dengan perintah netstat.<\/p>\n<pre class=\"lang:default decode:true\">$ sudo netstat -tlpn | grep nginx\r\n<\/pre>\n<div id=\"attachment_30980\" class=\"wp-caption aligncenter\" style=\"width: 804px;\">\n<p><a href=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-Port-Status.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30980\" style=\"display: inline;\" src=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-Port-Status.png?resize=794%2C62&#038;ssl=1\" sizes=\"auto, (max-width: 794px) 100vw, 794px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-Port-Status.png 794w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-Port-Status-768x60.png 768w\" alt=\"Check Nginx Port Status\" width=\"794\" height=\"62\" data-lazy-loaded=\"true\" \/><noscript><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30980\" src=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-Port-Status.png?resize=794%2C62&#038;ssl=1\" alt=\"Check Nginx Port Status\" width=\"794\" height=\"62\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-Port-Status.png 794w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-Port-Status-768x60.png 768w\" sizes=\"auto, (max-width: 794px) 100vw, 794px\" \/><\/noscript><\/a><\/p>\n<p class=\"wp-caption-text\">Check Nginx Port Status<\/p>\n<\/div>\n<p>Jika sistem Anda memiliki firewall, Anda perlu membuka port 80 dan 443 untuk memungkinkan lalu lintas HTTP dan HTTPS, dengan menjalankan.<\/p>\n<pre class=\"lang:default decode:true\">------------ On CentOS ------------\r\n$ sudo firewall-cmd --permanent --add-port=80\/tcp\r\n$ sudo firewall-cmd --permanent --add-port=443\/tcp\r\n$ sudo firewall-cmd --reload\r\n\r\n------------ On Ubuntu ------------\r\n$ sudo ufw allow 80\/tcp\r\n$ sudo ufw allow 443\/tcp\r\n$ sudo ufw reload \r\n<\/pre>\n<p>Metode ideal untuk menguji penginstalan Nginx dan memeriksa apakah itu berjalan dan dapat melayani halaman web adalah dengan membuka browser web dan menunjuk ke IP server.<\/p>\n<pre class=\"lang:default decode:true\">http:\/\/Your-IP-Address\r\nOR\r\nhttp:\/\/Your-Domain.com\r\n<\/pre>\n<p>Instalasi yang berhasil diindikasikan oleh layar berikut ini.<\/p>\n<div id=\"attachment_30982\" class=\"wp-caption aligncenter\" style=\"width: 759px;\">\n<p><a href=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-Web-Page.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30982\" style=\"display: inline;\" src=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-Web-Page.png?resize=749%2C403&#038;ssl=1\" alt=\"Check Nginx Web Page\" width=\"749\" height=\"403\" data-lazy-loaded=\"true\" \/><noscript><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30982\" src=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-Web-Page.png?resize=749%2C403&#038;ssl=1\" alt=\"Check Nginx Web Page\" width=\"749\" height=\"403\" \/><\/noscript><\/a><\/p>\n<p class=\"wp-caption-text\">Check Nginx Web Page<\/p>\n<\/div>\n<h3><span class=\"ez-toc-section\" id=\"Cara_Konfigurasi_Nginx_Web_Server\"><\/span>Cara Konfigurasi Nginx Web Server<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>File Konfigurasi Nginx berada pada directory <code>\/etc\/nginx<\/code>\u00a0dan global konfigurasinya di\u00a0\u00a0<code>\/etc\/nginx\/nginx.conf<\/code>\u00a0baik CentOS maupun Ubuntu.<\/p>\n<p>Nginx terdiri dari modul yang dikendalikan oleh berbagai opsi konfigurasi, yang dikenal sebagai\u00a0<strong>directives<\/strong>.\u00a0<strong>directive<\/strong>\u00a0sederhana nya (dalam bentuk nama dan nilai-nilai diakhiri dengan <code>;<\/code>) atau\u00a0<strong>block<\/strong> (\u00a0memiliki instruksi tambahan tertutup menggunakan <code>{}<\/code>).\u00a0Dan perintah blok yang berisi arahan lain disebut <strong>context<\/strong>.<\/p>\n<p>Semua arahan secara komprehensif dijelaskan dalam\u00a0<a href=\"https:\/\/nginx.org\/en\/docs\/\" target=\"_blank\" rel=\"nofollow noopener\">Nginx documentation<\/a> di situs web Nginx. Anda bisa merujuknya untuk informasi lebih lanjut.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"How_to_Serve_Static_Content_Using_Nginx_in_Standalone_Mode\"><\/span>How to Serve Static Content Using Nginx in Standalone Mode<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>At a foundational level, Nginx can be used to serve static content such as HTML and media files, in standalone mode, where only the default server block is used (analogous to Apache where no virtual hosts have been configured).<\/p>\n<p>We will start by briefly explaining the configuration structure in the main configuration file.<\/p>\n<pre class=\"lang:default decode:true\">$ sudo vim \/etc\/nginx\/nginx.conf\r\n<\/pre>\n<p>If you look into this Nginx configuration file, the configuration structure should appear as follows and this is referred to as the main context, which contains many other simple and block directives. All web traffic is handled in the http context.<\/p>\n<pre class=\"lang:default decode:true\">user  nginx;\r\nworker_processes  1;\r\n.....\r\n\r\nerror_log  \/var\/log\/nginx\/error.log warn;\r\npid        \/var\/run\/nginx.pid;\r\n.....\r\n\r\nevents {\r\n       \t.....\r\n}\r\n\r\nhttp {\r\n\tserver{\r\n\t\t\u2026\u2026.\r\n\t}\r\n\t.....\r\n}\r\n<\/pre>\n<p>The following is a sample Nginx main configuration (<strong>\/etc\/nginx\/nginx.conf<\/strong>) file, where the http block above contains an include directive which tells Nginx where to find website configuration files (virtual host configurations).<\/p>\n<div class=\"code-label\">Nginx Configuration File<\/div>\n<pre class=\"lang:default decode:true\">user www-data;\r\nworker_processes auto;\r\npid \/run\/nginx.pid;\r\n\r\nevents {\r\n        worker_connections 768;\r\n        # multi_accept on;\r\n}\r\n\r\nhttp {\r\n    include       \/etc\/nginx\/mime.types;\r\n    default_type  application\/octet-stream;\r\n\r\n   include \/etc\/nginx\/mime.types;\r\n   default_type application\/octet-stream;\r\n\r\n    access_log \/var\/log\/nginx\/access.log;\r\n    error_log \/var\/log\/nginx\/error.log;\r\n\r\n    sendfile        on;\r\n    #tcp_nopush     on;\r\n    keepalive_timeout  65;\r\n    #gzip  on;\r\n\t\r\n    include \/etc\/nginx\/conf.d\/*.conf;\r\n}\r\n<\/pre>\n<p>Note that on <strong>Ubuntu<\/strong>, you will also find an additional include directive (<strong>include \/etc\/nginx\/sites-enabled\/*;<\/strong>), where the directory <strong>\/etc\/nginx\/sites-enabled\/<\/strong> stores symlinks to the websites configuration files created in <strong>\/etc\/nginx\/sites-available\/<\/strong>, to enable the sites. And deleting a symlink disables that particular site.<\/p>\n<p>Based on your installation source, you\u2019ll find the default website configuration file at <strong>\/etc\/nginx\/conf.d\/default.conf<\/strong> (if you installed from official <strong>NGINX<\/strong> repository and <strong>EPEL<\/strong>) or <strong>\/etc\/nginx\/sites-enabled\/default<\/strong> (if you installed from Ubuntu repositories).<\/p>\n<p>This is our sample default nginx server block located at <strong>\/etc\/nginx\/conf.d\/default.conf<\/strong> on the test system.<\/p>\n<pre class=\"lang:default decode:true\">server {\r\n    listen    80 default_server;\r\n    listen    [::]:80 default_server;\r\n    server_name    _;\r\n    root           \/var\/www\/html\/;\r\n    index          index.html;\r\n    location \/ {\r\n                try_files $uri $uri\/ =404;\r\n        }\r\n}\r\n<\/pre>\n<p>A brief explanation of the directives in the above configuration:<\/p>\n<ul>\n<li><strong>listen<\/strong>: specifies the <strong>port<\/strong> the server listens on.<\/li>\n<li><strong>server_name<\/strong>: defines the server name which can be exact names, wildcard names, or regular expressions.<\/li>\n<li><strong>root<\/strong>: specifies the directory out of which Nginx will serve web pages and other documents.<\/li>\n<li><strong>index<\/strong>: specifies the type(s) of index file(s) to be served.<\/li>\n<li><strong>location<\/strong>: used to process requests for specific files and folders.<\/li>\n<\/ul>\n<p>From a web browser, when you point to the server using the <strong>hostname<\/strong> localhost or its IP address, it processes the request and serves the file <strong>\/var\/www\/html\/index.html<\/strong>, and immediately saves the event to its access log (<strong>\/var\/log\/nginx\/access.log<\/strong>) with a <strong>200 (OK) response<\/strong>. In case of an error (failed event), it records the message in the error log (<strong>\/var\/log\/nginx\/error.log<\/strong>).<\/p>\n<div id=\"attachment_30983\" class=\"wp-caption aligncenter\" style=\"width: 759px;\">\n<p><a href=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Test-Nginx-Default-Site.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30983\" style=\"display: inline;\" src=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Test-Nginx-Default-Site.png?resize=749%2C354&#038;ssl=1\" alt=\"Test Nginx Default Site\" width=\"749\" height=\"354\" data-lazy-loaded=\"true\" \/><noscript><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30983\" src=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Test-Nginx-Default-Site.png?resize=749%2C354&#038;ssl=1\" alt=\"Test Nginx Default Site\" width=\"749\" height=\"354\" \/><\/noscript><\/a><\/p>\n<p class=\"wp-caption-text\">Test Nginx Default Site<\/p>\n<\/div>\n<p>To learn more about logging in <strong>Nginx<\/strong>, you may refer to How to Configure Custom Access or Error Log Formats in Nginx.<\/p>\n<p>Instead of using the default log files, you can define custom log files for different web sites, as we shall look at later on, under the section \u201csetting up name-based virtual hosts (server blocks)\u201d.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"How_to_Restrict_Access_to_a_Web_Page_with_Nginx\"><\/span>How to Restrict Access to a Web Page with Nginx<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>In order to restrict access to your website\/application or some parts of it, you can setup basic HTTP authentication. This can be used essentially to restrict access to the whole HTTP server, individual server blocks or location blocks.<\/p>\n<p>Start by creating a file that will store your access credentials (<strong>username\/password<\/strong>) by using the <strong>htpasswd<\/strong> utility.<\/p>\n<pre class=\"lang:default decode:true\">$ yum install httpd-tools\t\t#RHEL\/CentOS\r\n$ sudo apt install apache2-utils\t#Debian\/Ubuntu\r\n<\/pre>\n<p>As an example, let\u2019s add user admin to this list (you can add as many users as possible), where the <code>-c<\/code> option is used to specify the password file, and the <code>-B<\/code> to encrypt the password. Once you hit <strong>[Enter]<\/strong>, you will be asked to enter the users password:<\/p>\n<pre class=\"lang:default decode:true\">$ sudo htpasswd -Bc \/etc\/nginx\/conf.d\/.htpasswd admin\r\n<\/pre>\n<p>Then, let\u2019s assign the proper permissions and ownership to the password file (replace the user and group nginx with <strong>www-data<\/strong> on Ubuntu).<\/p>\n<pre class=\"lang:default decode:true\">$ sudo chmod 640 \/etc\/nginx\/conf.d\/.htpasswd\r\n$ sudo chown nginx:nginx \/etc\/nginx\/conf.d\/.htpasswd\r\n<\/pre>\n<p>As we mentioned earlier on, you can restrict access to your webserver, a single website (using its server block) or specific directory or file. Two useful directives can be used to achieve this:<\/p>\n<ul>\n<li><strong>auth_basic<\/strong> \u2013 turns on validation of user name and password using the \u201c<strong>HTTP Basic Authentication<\/strong>\u201d protocol.<\/li>\n<li><strong>auth_basic_user_file<\/strong> \u2013 specifies the credential\u2019s file.<\/li>\n<\/ul>\n<p>As an example, we will show how to password-protect the directory <strong>\/var\/www\/html\/protected<\/strong>.<\/p>\n<pre class=\"lang:default decode:true\">server {\r\n    listen         80 default_server;\r\n    server_name    localhost;\r\n    root           \/var\/www\/html\/;\r\n    index          index.html;\r\n    location \/ {\r\n                try_files $uri $uri\/ =404;\r\n        }\r\n     \r\n    location \/protected\/ {\r\n        auth_basic              \"Restricted Access!\";\r\n        auth_basic_user_file    \/etc\/nginx\/conf.d\/.htpasswd;\r\n    }\r\n}\r\n<\/pre>\n<p>Now, save changes and restart Nginx service.<\/p>\n<pre class=\"lang:default decode:true\">$ sudo systemctl restart nginx \r\n<\/pre>\n<p>The next time you point your browser to the above directory (<strong>http:\/\/localhost\/protected<\/strong>) you will be asked to enter your login credentials (username <strong>admin<\/strong> and the chosen password).<\/p>\n<p>A successful login allows you to access the directory\u2019s contents, otherwise you will get a a \u201c<strong>401 Authorization Required<\/strong>\u201d error.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_to_Setup_Name-based_Virtual_hosts_Server_Blocks_in_Nginx\"><\/span>How to Setup Name-based Virtual hosts (Server Blocks) in Nginx<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The server context allows multiple domains\/sites to be stored in and served from the same physical machine or virtual private server (VPS). Multiple server blocks (representing virtual hosts) can be declared within the http context for each site\/domain. Nginx decides which server processes a request based on the request header it receives.<\/p>\n<p>We will demonstrate this concept using the following dummy domains, each located in the specified directory:<\/p>\n<ul>\n<li>wearetecmint.com \u2013 <strong>\/var\/www\/html\/wearetecmint.com\/<\/strong><\/li>\n<li>welovelinux.com \u2013 <strong>\/var\/www\/html\/welovelinux.com\/<\/strong><\/li>\n<\/ul>\n<p>Next, assign the appropriate permissions on the directory for each site.<\/p>\n<pre class=\"lang:default decode:true\">$ sudo chmod -R 755 \/var\/www\/html\/wearetecmint.com\/public_html \r\n$ sudo chmod -R 755 \/var\/www\/html\/welovelinux.com\/public_html \r\n<\/pre>\n<p>Now, create a sample <strong>index.html<\/strong> file inside each <strong>public_html<\/strong> directory.<\/p>\n<pre class=\"lang:default decode:true\">&lt;html&gt;\r\n\t&lt;head&gt;\r\n\t\t&lt;title&gt;www.wearetecmint.com&lt;\/title&gt;\r\n\t&lt;\/head&gt;\r\n&lt;body&gt;\r\n\t&lt;h1&gt;This is the index page of www.wearetecmint.com&lt;\/h1&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>Next, create the server block configuration files for each site inside the <strong>\/etc\/httpd\/conf.d<\/strong> directory.<\/p>\n<pre class=\"lang:default decode:true\">$ sudo vi \/etc\/nginx\/conf.d\/wearetecmint.com.conf\r\n$ sudo vi \/etc\/nginx\/conf.d\/welovelinux.com.conf\r\n<\/pre>\n<p>Add the following server block declaration in the <strong>wearetecmint.com.conf<\/strong> file.<\/p>\n<div class=\"code-label\">wearetecmint.com.conf<\/div>\n<pre class=\"lang:default decode:true\">server {\r\n    listen         80;\r\n    server_name  wearetecmint.com;\r\n    root           \/var\/www\/html\/wearetecmint.com\/public_html ;\r\n    index          index.html;\r\n    location \/ {\r\n                try_files $uri $uri\/ =404;\r\n        }\r\n     \r\n}\r\n<\/pre>\n<p>Next, add the following server block declaration in the <strong>welovelinux.com.conf<\/strong> file.<\/p>\n<div class=\"code-label\">welovelinux.com.conf<\/div>\n<pre class=\"lang:default decode:true\">server {\r\n    listen         80;\r\n    server_name    welovelinux.com;\r\n    root           \/var\/www\/html\/welovelinux.com\/public_html;\r\n    index          index.html;\r\n    location \/ {\r\n                try_files $uri $uri\/ =404;\r\n        }\r\n     \r\n}\r\n<\/pre>\n<p>To apply the recent changes, restart the Nginx web server.<\/p>\n<pre class=\"lang:default decode:true\">$ sudo systemctl restart nginx\r\n<\/pre>\n<p>and pointing your web server to the above addresses should make you see the main pages of the dummy domains.<\/p>\n<pre class=\"lang:default decode:true\">http:\/\/wearetecmint.com\r\nhttp:\/\/welovelinux.com\r\n<\/pre>\n<div id=\"attachment_30984\" class=\"wp-caption aligncenter\" style=\"width: 900px;\">\n<p><a href=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Test-Nginx-Virtual-Hosts-Websites.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30984\" style=\"display: inline;\" src=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Test-Nginx-Virtual-Hosts-Websites.png?resize=890%2C296&#038;ssl=1\" sizes=\"auto, (max-width: 890px) 100vw, 890px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Test-Nginx-Virtual-Hosts-Websites.png 890w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Test-Nginx-Virtual-Hosts-Websites-768x255.png 768w\" alt=\"Test Nginx Virtual Hosts Websites\" width=\"890\" height=\"296\" data-lazy-loaded=\"true\" \/><noscript><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30984\" src=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Test-Nginx-Virtual-Hosts-Websites.png?resize=890%2C296&#038;ssl=1\" alt=\"Test Nginx Virtual Hosts Websites\" width=\"890\" height=\"296\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Test-Nginx-Virtual-Hosts-Websites.png 890w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Test-Nginx-Virtual-Hosts-Websites-768x255.png 768w\" sizes=\"auto, (max-width: 890px) 100vw, 890px\" \/><\/noscript><\/a><\/p>\n<p class=\"wp-caption-text\">Test Nginx Virtual Hosts Websites<\/p>\n<\/div>\n<p><strong style=\"color: red;\">Important<\/strong>: If you have <strong>SELinux<\/strong> enabled, its default configuration does not allow Nginx to access files outside of well-known authorized locations (such as <strong>\/etc\/nginx<\/strong> for configurations, <strong>\/var\/log\/nginx<\/strong> for logs, <strong>\/var\/www\/html<\/strong> for web files etc..).<\/p>\n<p>You can handle this by either disabling SELinux, or setting the correct security context. For more information, refer to this guide: <a href=\"https:\/\/www.nginx.com\/blog\/using-nginx-plus-with-selinux\/\" target=\"_blank\" rel=\"nofollow noopener\">using Nginx and Nginx Plus with SELinux<\/a> on the Nginx Plus website.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_to_Install_and_Configure_SSL_with_Nginx\"><\/span>How to Install and Configure SSL with Nginx<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>SSL<\/strong> certificates help to enable secure http (<strong>HTTPS<\/strong>) on your site, which is essential to establishing a trusted\/secure connection between the end users and your server by encrypting the information that is transmitted to, from, or within your site.<\/p>\n<p>We will cover how to create and install a self-signed certificate, and generate a certificate signing request (<strong>CSR<\/strong>) to acquire an SSL certificate from a certificate authority (<strong>CA<\/strong>), to use with Nginx.<\/p>\n<p>Self-signed certificates are free to create and are practically good to go for testing purposes and for internal LAN-only services. For public-facing servers, it is highly recommended to use a certificate issued by a CA (for example <a href=\"https:\/\/www.tecmint.com\/setup-https-with-lets-encrypt-ssl-certificate-for-nginx-on-centos\/\" target=\"_blank\" rel=\"noopener\">Let\u2019s Encrypt<\/a>) to uphold its authenticity.<\/p>\n<p>To create a self-signed certificate, first create a directory where your certificates will be stored.<\/p>\n<pre class=\"lang:default decode:true\">$ sudo mkdir \/etc\/nginx\/ssl-certs\/\r\n<\/pre>\n<p>Then generate your self-signed certificate and the key using the <strong>openssl<\/strong> command line tool.<\/p>\n<pre class=\"lang:default decode:true\">$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout \/etc\/nginx\/ssl-certs\/nginx.key -out \/etc\/nginx\/ssl-certs\/nginx.crt\r\n<\/pre>\n<p>Let\u2019s briefly describe the options used in the above command:<\/p>\n<ul>\n<li><strong>req -X509<\/strong> \u2013 shows we are creating a x509 certificate.<\/li>\n<li><strong>-nodes (NO DES)<\/strong> \u2013 means \u201cdon\u2019t encrypt the key\u201d.<\/li>\n<li><strong>-days 365<\/strong> \u2013 specifies the number of days the certificate will be valid for.<\/li>\n<li><strong>-newkey rsa:2048<\/strong> \u2013 specifies that the key generated using RSA algorithm should be 2048-bit.<\/li>\n<li><strong>-keyout \/etc\/nginx\/ssl-certs\/nginx.key<\/strong> \u2013 specifies the full path of the RSA key.<\/li>\n<li><strong>-out \/etc\/nginx\/ssl-certs\/nginx.crt<\/strong> \u2013 specifies the full path of the certificate.<\/li>\n<\/ul>\n<div id=\"attachment_30985\" class=\"wp-caption aligncenter\" style=\"width: 812px;\">\n<p><a href=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Create-SSL-Certificate-and-Key-for-Nginx.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30985\" style=\"display: inline;\" src=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Create-SSL-Certificate-and-Key-for-Nginx.png?resize=802%2C420&#038;ssl=1\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Create-SSL-Certificate-and-Key-for-Nginx.png 802w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Create-SSL-Certificate-and-Key-for-Nginx-768x402.png 768w\" alt=\"Create SSL Certificate and Key for Nginx\" width=\"802\" height=\"420\" data-lazy-loaded=\"true\" \/><noscript><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30985\" src=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Create-SSL-Certificate-and-Key-for-Nginx.png?resize=802%2C420&#038;ssl=1\" alt=\"Create SSL Certificate and Key for Nginx\" width=\"802\" height=\"420\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Create-SSL-Certificate-and-Key-for-Nginx.png 802w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Create-SSL-Certificate-and-Key-for-Nginx-768x402.png 768w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><\/noscript><\/a><\/p>\n<p class=\"wp-caption-text\">Create SSL Certificate and Key for Nginx<\/p>\n<\/div>\n<p>Next, open your virtual host configuration file and add the following lines to a server block declaration listening on port <strong>443<\/strong>. We will test with the virtual host file <strong>\/etc\/nginx\/conf.d\/wearetecmint.com.conf<\/strong>.<\/p>\n<pre class=\"lang:default decode:true\">$ sudo vi \/etc\/nginx\/conf.d\/wearetecmint.com.conf\r\n<\/pre>\n<p>Then add the ssl directive to nginx configuration file, it should look similar to below.<\/p>\n<pre class=\"lang:default decode:true\">server {\r\n    listen 80;\r\n    listen [::]:80;\r\n    listen 443 ssl;\r\n    listen [::]:443 ssl;\r\n    \r\n    ssl on;\r\n    ssl_certificate \/etc\/nginx\/ssl-certs\/nginx.crt;\r\n    ssl_trusted_certificate \/etc\/nginx\/ssl-certs\/nginx.crt;\r\n    ssl_certificate_key \/etc\/nginx\/ssl-certs\/nginx.key;\r\n    \r\n    server_name  wearetecmint.com;\r\n    root           \/var\/www\/html\/wearetecmint.com\/public_html;\r\n    index          index.html;\r\n    location \/ {\r\n                try_files $uri $uri\/ =404;\r\n        }\r\n\r\n}\r\n<\/pre>\n<p>Now restart the Nginx and point your browser to the following address.<\/p>\n<pre class=\"lang:default decode:true\">https:\/\/www.wearetecmint.com\r\n<\/pre>\n<div id=\"attachment_30986\" class=\"wp-caption aligncenter\" style=\"width: 908px;\">\n<p><a href=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-SSL-Website.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30986\" style=\"display: inline;\" src=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-SSL-Website.png?resize=898%2C221&#038;ssl=1\" sizes=\"auto, (max-width: 898px) 100vw, 898px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-SSL-Website.png 898w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-SSL-Website-768x189.png 768w\" alt=\"Check Nginx SSL Website\" width=\"898\" height=\"221\" data-lazy-loaded=\"true\" \/><noscript><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30986\" src=\"https:\/\/i0.wp.com\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-SSL-Website.png?resize=898%2C221&#038;ssl=1\" alt=\"Check Nginx SSL Website\" width=\"898\" height=\"221\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-SSL-Website.png 898w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/11\/Check-Nginx-SSL-Website-768x189.png 768w\" sizes=\"auto, (max-width: 898px) 100vw, 898px\" \/><\/noscript><\/a><\/p>\n<p class=\"wp-caption-text\">Check Nginx SSL Website<\/p>\n<\/div>\n<p>If you would like to purchase an SSL certificate from a CA, you need to generate a certificate signing request (CSR) as shown.<\/p>\n<pre class=\"lang:default decode:true\">$ sudo openssl req -newkey rsa:2048 -nodes -keyout \/etc\/nginx\/ssl-certs\/example.com.key -out \/etc\/nginx\/ssl-certs\/example.com.csr\r\n<\/pre>\n<p>You can also create a CSR from an existing private key.<\/p>\n<pre class=\"lang:default decode:true\">$ sudo openssl req -key \/etc\/nginx\/ssl-certs\/example.com.key -new -out \/etc\/nginx\/ssl-certs\/example.com.csr\r\n<\/pre>\n<p>Then, you need to send the <strong>CSR<\/strong> that is generated to a <strong>CA<\/strong> to request the issuance of a CA-signed SSL certificate. Once you receive your certificate from the CA, you can configure it as shown above.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>In this article, we have explained how to install and configure Nginx; covered how to setup name-based virtual hosting with SSL to secure data transmissions between the web server and a client.<\/p>\n<p>If you experienced any setbacks during your nginx installation\/configuration process or have any questions or comments, use the feedback form below to reach us.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nginx (singkatan dari Engine-x) adalah server HTTP dan reverse proxy yang bebas, open source, kuat, berkinerja tinggi, dan dapat diukur, email dan server proxy TCP \/ UDP standar. Nginx mudah digunakan dan dikonfigurasi, dengan bahasa konfigurasi yang sederhana. Nginx sekarang menjadi perangkat lunak server web yang lebih disukai untuk memberdayakan situs-situs yang sarat muatan, karena [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1921,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[91],"tags":[],"class_list":["post-1918","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Cara Install Nginx dengan Virtual Hosts dan Certificate SSL - Hostnic.id<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/\" \/>\n<meta property=\"og:locale\" content=\"id_ID\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Cara Install Nginx dengan Virtual Hosts dan Certificate SSL - Hostnic.id\" \/>\n<meta property=\"og:description\" content=\"Nginx (singkatan dari Engine-x) adalah server HTTP dan reverse proxy yang bebas, open source, kuat, berkinerja tinggi, dan dapat diukur, email dan server proxy TCP \/ UDP standar. Nginx mudah digunakan dan dikonfigurasi, dengan bahasa konfigurasi yang sederhana. Nginx sekarang menjadi perangkat lunak server web yang lebih disukai untuk memberdayakan situs-situs yang sarat muatan, karena [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/\" \/>\n<meta property=\"og:site_name\" content=\"Hostnic.id\" \/>\n<meta property=\"article:published_time\" content=\"2018-12-18T03:34:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-12-18T09:21:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.hostnic.id\/blog\/wp-content\/uploads\/2018\/12\/How-to-install-and-configure-Nginx-in-Redhat.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ari Sigit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Ditulis oleh\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ari Sigit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimasi waktu membaca\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 menit\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/tutorial\\\/linux\\\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/tutorial\\\/linux\\\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\\\/\"},\"author\":{\"name\":\"Ari Sigit\",\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/#\\\/schema\\\/person\\\/a782d1235d484e7630007157996e5a49\"},\"headline\":\"Cara Install Nginx dengan Virtual Hosts dan Certificate SSL\",\"datePublished\":\"2018-12-18T03:34:06+00:00\",\"dateModified\":\"2018-12-18T09:21:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/tutorial\\\/linux\\\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\\\/\"},\"wordCount\":1741,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/tutorial\\\/linux\\\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.hostnic.id\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/12\\\/How-to-install-and-configure-Nginx-in-Redhat.png?fit=1366%2C768&ssl=1\",\"articleSection\":[\"Linux\"],\"inLanguage\":\"id\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/tutorial\\\/linux\\\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/tutorial\\\/linux\\\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\\\/\",\"url\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/tutorial\\\/linux\\\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\\\/\",\"name\":\"Cara Install Nginx dengan Virtual Hosts dan Certificate SSL - Hostnic.id\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/tutorial\\\/linux\\\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/tutorial\\\/linux\\\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.hostnic.id\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/12\\\/How-to-install-and-configure-Nginx-in-Redhat.png?fit=1366%2C768&ssl=1\",\"datePublished\":\"2018-12-18T03:34:06+00:00\",\"dateModified\":\"2018-12-18T09:21:14+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/#\\\/schema\\\/person\\\/a782d1235d484e7630007157996e5a49\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/tutorial\\\/linux\\\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\\\/#breadcrumb\"},\"inLanguage\":\"id\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/tutorial\\\/linux\\\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"id\",\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/tutorial\\\/linux\\\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.hostnic.id\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/12\\\/How-to-install-and-configure-Nginx-in-Redhat.png?fit=1366%2C768&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.hostnic.id\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/12\\\/How-to-install-and-configure-Nginx-in-Redhat.png?fit=1366%2C768&ssl=1\",\"width\":1366,\"height\":768,\"caption\":\"Cara Install Nginx dengan Virtual Hosts dan Sertificate SSL\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/tutorial\\\/linux\\\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cara Install Nginx dengan Virtual Hosts dan Certificate SSL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/\",\"name\":\"hostnic.id\",\"description\":\"Info, Tips dan Tutorial Seputar Layanan Hostnic\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"id\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/#\\\/schema\\\/person\\\/a782d1235d484e7630007157996e5a49\",\"name\":\"Ari Sigit\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"id\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/140001cab6874fc4d4cecb4b3519ceca05b4fa2543ed46c5dae3704831ed3a2d?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/140001cab6874fc4d4cecb4b3519ceca05b4fa2543ed46c5dae3704831ed3a2d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/140001cab6874fc4d4cecb4b3519ceca05b4fa2543ed46c5dae3704831ed3a2d?s=96&d=mm&r=g\",\"caption\":\"Ari Sigit\"},\"description\":\"Application Developer &amp; Support Specialist\",\"url\":\"https:\\\/\\\/www.hostnic.id\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Cara Install Nginx dengan Virtual Hosts dan Certificate SSL - Hostnic.id","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/","og_locale":"id_ID","og_type":"article","og_title":"Cara Install Nginx dengan Virtual Hosts dan Certificate SSL - Hostnic.id","og_description":"Nginx (singkatan dari Engine-x) adalah server HTTP dan reverse proxy yang bebas, open source, kuat, berkinerja tinggi, dan dapat diukur, email dan server proxy TCP \/ UDP standar. Nginx mudah digunakan dan dikonfigurasi, dengan bahasa konfigurasi yang sederhana. Nginx sekarang menjadi perangkat lunak server web yang lebih disukai untuk memberdayakan situs-situs yang sarat muatan, karena [&hellip;]","og_url":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/","og_site_name":"Hostnic.id","article_published_time":"2018-12-18T03:34:06+00:00","article_modified_time":"2018-12-18T09:21:14+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.hostnic.id\/blog\/wp-content\/uploads\/2018\/12\/How-to-install-and-configure-Nginx-in-Redhat.png","type":"image\/png"}],"author":"Ari Sigit","twitter_card":"summary_large_image","twitter_misc":{"Ditulis oleh":"Ari Sigit","Estimasi waktu membaca":"11 menit"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#article","isPartOf":{"@id":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/"},"author":{"name":"Ari Sigit","@id":"https:\/\/www.hostnic.id\/blog\/#\/schema\/person\/a782d1235d484e7630007157996e5a49"},"headline":"Cara Install Nginx dengan Virtual Hosts dan Certificate SSL","datePublished":"2018-12-18T03:34:06+00:00","dateModified":"2018-12-18T09:21:14+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/"},"wordCount":1741,"commentCount":0,"image":{"@id":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2018\/12\/How-to-install-and-configure-Nginx-in-Redhat.png?fit=1366%2C768&ssl=1","articleSection":["Linux"],"inLanguage":"id","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/","url":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/","name":"Cara Install Nginx dengan Virtual Hosts dan Certificate SSL - Hostnic.id","isPartOf":{"@id":"https:\/\/www.hostnic.id\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#primaryimage"},"image":{"@id":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2018\/12\/How-to-install-and-configure-Nginx-in-Redhat.png?fit=1366%2C768&ssl=1","datePublished":"2018-12-18T03:34:06+00:00","dateModified":"2018-12-18T09:21:14+00:00","author":{"@id":"https:\/\/www.hostnic.id\/blog\/#\/schema\/person\/a782d1235d484e7630007157996e5a49"},"breadcrumb":{"@id":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#breadcrumb"},"inLanguage":"id","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/"]}]},{"@type":"ImageObject","inLanguage":"id","@id":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#primaryimage","url":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2018\/12\/How-to-install-and-configure-Nginx-in-Redhat.png?fit=1366%2C768&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2018\/12\/How-to-install-and-configure-Nginx-in-Redhat.png?fit=1366%2C768&ssl=1","width":1366,"height":768,"caption":"Cara Install Nginx dengan Virtual Hosts dan Sertificate SSL"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-dengan-virtual-hosts-dan-certificate-ssl\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hostnic.id\/blog\/"},{"@type":"ListItem","position":2,"name":"Cara Install Nginx dengan Virtual Hosts dan Certificate SSL"}]},{"@type":"WebSite","@id":"https:\/\/www.hostnic.id\/blog\/#website","url":"https:\/\/www.hostnic.id\/blog\/","name":"hostnic.id","description":"Info, Tips dan Tutorial Seputar Layanan Hostnic","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hostnic.id\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"id"},{"@type":"Person","@id":"https:\/\/www.hostnic.id\/blog\/#\/schema\/person\/a782d1235d484e7630007157996e5a49","name":"Ari Sigit","image":{"@type":"ImageObject","inLanguage":"id","@id":"https:\/\/secure.gravatar.com\/avatar\/140001cab6874fc4d4cecb4b3519ceca05b4fa2543ed46c5dae3704831ed3a2d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/140001cab6874fc4d4cecb4b3519ceca05b4fa2543ed46c5dae3704831ed3a2d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/140001cab6874fc4d4cecb4b3519ceca05b4fa2543ed46c5dae3704831ed3a2d?s=96&d=mm&r=g","caption":"Ari Sigit"},"description":"Application Developer &amp; Support Specialist","url":"https:\/\/www.hostnic.id\/blog\/author\/admin\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2018\/12\/How-to-install-and-configure-Nginx-in-Redhat.png?fit=1366%2C768&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8D2mv-uW","jetpack-related-posts":[{"id":8079,"url":"https:\/\/www.hostnic.id\/blog\/teknologi\/502-bad-gateway-nginx-penyebab-dan-cara-mengatasinya\/","url_meta":{"origin":1918,"position":0},"title":"502 Bad Gateway Nginx: Penyebab dan Cara Mengatasinya","author":"Monic","date":"2023-10-04","format":false,"excerpt":"Hostnic.id -\u00a0Saat menjelajahi internet, Anda mungkin pernah mengalami pesan kesalahan \"502 Bad Gateway\" yang terkait dengan server web Nginx. Pesan kesalahan ini menunjukkan bahwa server Nginx yang bertindak sebagai gateway atau proxy mengalami masalah saat mencoba menghubungi server upstream (server utama yang diminta). Kode status 502 Bad Gateway umumnya muncul\u2026","rel":"","context":"dalam &quot;Teknologi&quot;","block_context":{"text":"Teknologi","link":"https:\/\/www.hostnic.id\/blog\/.\/teknologi\/"},"img":{"alt_text":"502 Bad Gateway Nginx: Penyebab dan Cara Mengatasinya","src":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/10\/Nginx.png?fit=669%2C310&ssl=1%3Fv%3D1696404224&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/10\/Nginx.png?fit=669%2C310&ssl=1%3Fv%3D1696404224&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/10\/Nginx.png?fit=669%2C310&ssl=1%3Fv%3D1696404224&resize=525%2C300 1.5x"},"classes":[]},{"id":1992,"url":"https:\/\/www.hostnic.id\/blog\/tutorial\/linux\/cara-install-nginx-mysql-mariadb-dan-php-pada-rhel-8\/","url_meta":{"origin":1918,"position":1},"title":"Cara Install Nginx, MySQL\/MariaDB dan PHP pada RHEL 8","author":"Ari Sigit","date":"2018-12-31","format":false,"excerpt":"Banyak pembaca tahu tentang LAMP, tetapi sedikit orang yang menyadari LEMP, yang menggantikan server web Apache dengan Nginx. Setiap server web memiliki pro dan kontra dan itu tergantung pada situasi spesifik Anda yang mana yang akan Anda pilih untuk digunakan. Dalam tutorial ini, kami akan menunjukkan kepada Anda bagaimana menginstal\u2026","rel":"","context":"dalam &quot;Linux&quot;","block_context":{"text":"Linux","link":"https:\/\/www.hostnic.id\/blog\/.\/tutorial\/linux\/"},"img":{"alt_text":"Cara Install Apache, MySQL\/MariaDB dan PHP pada RHEL 8","src":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2018\/12\/lamp.png?fit=940%2C529&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2018\/12\/lamp.png?fit=940%2C529&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2018\/12\/lamp.png?fit=940%2C529&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2018\/12\/lamp.png?fit=940%2C529&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":8083,"url":"https:\/\/www.hostnic.id\/blog\/teknologi\/cara-mengatasi-502-bad-gateway-nginx-solusi-untuk-mengatasi-gangguan-jaringan\/","url_meta":{"origin":1918,"position":2},"title":"Cara Mengatasi 502 Bad Gateway Nginx: Solusi untuk Mengatasi Gangguan Jaringan","author":"Monic","date":"2023-10-04","format":false,"excerpt":"Hostnic.id -\u00a0502 Bad Gateway adalah pesan kesalahan umum yang muncul saat menggunakan server web Nginx. Pesan kesalahan ini menunjukkan bahwa Nginx sebagai server gateway atau proxy tidak dapat menerima respons yang valid dari server upstream yang diminta. Salah satu penyebab umum dari kesalahan ini adalah gangguan jaringan antara server Nginx\u2026","rel":"","context":"dalam &quot;Teknologi&quot;","block_context":{"text":"Teknologi","link":"https:\/\/www.hostnic.id\/blog\/.\/teknologi\/"},"img":{"alt_text":"Cara Mengatasi 502 Bad Gateway Nginx: Solusi untuk Mengatasi Gangguan Jaringan","src":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/10\/CN.png?fit=717%2C396&ssl=1%3Fv%3D1696404538&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/10\/CN.png?fit=717%2C396&ssl=1%3Fv%3D1696404538&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/10\/CN.png?fit=717%2C396&ssl=1%3Fv%3D1696404538&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/10\/CN.png?fit=717%2C396&ssl=1%3Fv%3D1696404538&resize=700%2C400 2x"},"classes":[]},{"id":6299,"url":"https:\/\/www.hostnic.id\/blog\/berita\/aplikasi-berbasis-linux-yang-dapat-digunakan-untuk-melakukan-load-balanci\/","url_meta":{"origin":1918,"position":3},"title":"Aplikasi Berbasis Linux yang Dapat Digunakan untuk Melakukan Load Balanci","author":"Monic","date":"2023-08-10","format":false,"excerpt":"Hostnic.id\u00a0\u2013\u00a0Dalam dunia TI yang terus berkembang, load balancing menjadi kunci penting dalam mengoptimalkan kinerja jaringan. Dengan menggunakan load balancing, lalu lintas dapat didistribusikan secara merata ke beberapa server backend, mengurangi beban pada setiap server individual, dan meningkatkan ketersediaan dan skalabilitas sistem. Dalam lingkungan Linux, terdapat berbagai aplikasi yang dapat digunakan\u2026","rel":"","context":"dalam &quot;Berita&quot;","block_context":{"text":"Berita","link":"https:\/\/www.hostnic.id\/blog\/.\/berita\/"},"img":{"alt_text":"Aplikasi Berbasis Linux yang Dapat Digunakan untuk Melakukan Load Balanci","src":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/08\/AL.png?fit=1163%2C607&ssl=1%3Fv%3D1691634688&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/08\/AL.png?fit=1163%2C607&ssl=1%3Fv%3D1691634688&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/08\/AL.png?fit=1163%2C607&ssl=1%3Fv%3D1691634688&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/08\/AL.png?fit=1163%2C607&ssl=1%3Fv%3D1691634688&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/08\/AL.png?fit=1163%2C607&ssl=1%3Fv%3D1691634688&resize=1050%2C600 3x"},"classes":[]},{"id":6304,"url":"https:\/\/www.hostnic.id\/blog\/teknologi\/aplikasi-berbasis-linux-yang-dapat-digunakan-untuk-melakukan-load-balancing\/","url_meta":{"origin":1918,"position":4},"title":"Aplikasi Berbasis Linux Yang Dapat Digunakan Untuk Melakukan Load Balancing","author":"Monic","date":"2023-08-10","format":false,"excerpt":"Hostnic.id\u00a0\u2013\u00a0Dalam era teknologi yang terus berkembang, kebutuhan akan infrastruktur jaringan yang handal dan skalabel menjadi semakin penting. Load balancing adalah salah satu elemen kunci dalam memastikan ketersediaan, kinerja, dan kehandalan sistem. Dalam lingkungan Linux, terdapat sejumlah aplikasi yang populer dan efektif yang dapat digunakan untuk melakukan load balancing. Dalam artikel\u2026","rel":"","context":"dalam &quot;Teknologi&quot;","block_context":{"text":"Teknologi","link":"https:\/\/www.hostnic.id\/blog\/.\/teknologi\/"},"img":{"alt_text":"Aplikasi berbasis Linux yang dapat digunakan untuk melakukan load balancing","src":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/08\/ABL.png?fit=673%2C367&ssl=1%3Fv%3D1691636497&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/08\/ABL.png?fit=673%2C367&ssl=1%3Fv%3D1691636497&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/08\/ABL.png?fit=673%2C367&ssl=1%3Fv%3D1691636497&resize=525%2C300 1.5x"},"classes":[]},{"id":8085,"url":"https:\/\/www.hostnic.id\/blog\/teknologi\/502-bad-gateway-nginx-1-18-0-ubuntu-penyebab-dan-solusi-masalah-jaringan\/","url_meta":{"origin":1918,"position":5},"title":"502 Bad Gateway Nginx\/1.18.0 (Ubuntu): Penyebab dan Solusi Masalah Jaringan","author":"Monic","date":"2023-10-04","format":false,"excerpt":"Hostnic.id -\u00a0502 Bad Gateway adalah pesan kesalahan yang sering muncul pada server web Nginx\/1.18.0 yang menjalankan sistem operasi Ubuntu. Pesan kesalahan ini menunjukkan adanya masalah jaringan yang menghalangi server Nginx untuk menerima respons yang valid dari server upstream. Dalam artikel ini, kita akan membahas penyebab umum dari kesalahan 502 Bad\u2026","rel":"","context":"dalam &quot;Teknologi&quot;","block_context":{"text":"Teknologi","link":"https:\/\/www.hostnic.id\/blog\/.\/teknologi\/"},"img":{"alt_text":"502 Bad Gateway Nginx\/1.18.0 (Ubuntu): Penyebab dan Solusi Masalah Jaringan","src":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/10\/NU.png?fit=1057%2C591&ssl=1%3Fv%3D1696404664&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/10\/NU.png?fit=1057%2C591&ssl=1%3Fv%3D1696404664&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/10\/NU.png?fit=1057%2C591&ssl=1%3Fv%3D1696404664&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/10\/NU.png?fit=1057%2C591&ssl=1%3Fv%3D1696404664&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.hostnic.id\/blog\/wp-content\/uploads\/2023\/10\/NU.png?fit=1057%2C591&ssl=1%3Fv%3D1696404664&resize=1050%2C600 3x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.hostnic.id\/blog\/wp-json\/wp\/v2\/posts\/1918","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostnic.id\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostnic.id\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostnic.id\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostnic.id\/blog\/wp-json\/wp\/v2\/comments?post=1918"}],"version-history":[{"count":2,"href":"https:\/\/www.hostnic.id\/blog\/wp-json\/wp\/v2\/posts\/1918\/revisions"}],"predecessor-version":[{"id":1923,"href":"https:\/\/www.hostnic.id\/blog\/wp-json\/wp\/v2\/posts\/1918\/revisions\/1923"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostnic.id\/blog\/wp-json\/wp\/v2\/media\/1921"}],"wp:attachment":[{"href":"https:\/\/www.hostnic.id\/blog\/wp-json\/wp\/v2\/media?parent=1918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostnic.id\/blog\/wp-json\/wp\/v2\/categories?post=1918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostnic.id\/blog\/wp-json\/wp\/v2\/tags?post=1918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}