<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>devkuma – Nginx</title>
    <link>https://www.devkuma.com/en/tags/nginx/</link>
    <image>
      <url>https://www.devkuma.com/en/tags/nginx/logo/180x180.jpg</url>
      <title>Nginx</title>
      <link>https://www.devkuma.com/en/tags/nginx/</link>
    </image>
    <description>Recent content in Nginx on devkuma</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>kc@example.com (kc kim)</managingEditor>
    <webMaster>kc@example.com (kc kim)</webMaster>
    <copyright>The devkuma</copyright>
    
	  <atom:link href="https://www.devkuma.com/en/tags/nginx/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Nginx</title>
      <link>https://www.devkuma.com/en/docs/nginx/overview/</link>
      <pubDate>Wed, 26 May 2021 09:21:39 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/nginx/overview/</guid>
      <description>
        
        
        &lt;h2 id=&#34;what-is-nginx&#34;&gt;What Is Nginx?&lt;/h2&gt;
&lt;p&gt;Nginx is a free, open-source web server developed by Russian developer Igor Sysoev.&lt;/p&gt;
&lt;p&gt;It was proposed as an alternative web server to Apache. Apache had a weakness when handling many simultaneous connections. Problems could occur when there were around 10,000 clients.
Nginx was developed as web server software that can withstand high load.&lt;/p&gt;
&lt;h2 id=&#34;what-is-a-web-server&#34;&gt;What Is a Web Server?&lt;/h2&gt;
&lt;p&gt;A web server receives requests from outside, returns static content from the web server, and when dynamic content is requested from an application server, returns the application server&amp;rsquo;s processing result to the client.&lt;/p&gt;
&lt;p&gt;Nginx is one example of this kind of web server.&lt;/p&gt;
&lt;h2 id=&#34;differences-between-apache-and-nginx&#34;&gt;Differences Between Apache and Nginx&lt;/h2&gt;
&lt;p&gt;Apache is often mentioned together with Nginx. Apache is a representative web server. Nginx was originally created to solve the problem where Apache and ordinary web servers respond poorly under a large number of simultaneous accesses.&lt;/p&gt;
&lt;h3 id=&#34;main-differences&#34;&gt;Main Differences&lt;/h3&gt;
&lt;p&gt;Apache characteristics&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It has rich functionality as a web server and is easy to use.&lt;/li&gt;
&lt;li&gt;Because it provides many features, server cost is high.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Nginx characteristics&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It has reverse proxy functionality, acting as an intermediary for web servers and responding to requests, and is specialized for processing simultaneous requests.&lt;/li&gt;
&lt;li&gt;It supports non-blocking I/O and is specialized for large data transfers and many simultaneous connections.&lt;/li&gt;
&lt;li&gt;Because it is simple, server cost is low.&lt;/li&gt;
&lt;li&gt;One advantage is that it can hide the existence of the web server, and when there are multiple web servers, it can distribute processing. In other words, it can function like a load balancer. This gives it strong characteristics for many simultaneous requests.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;how-apache-and-nginx-run&#34;&gt;How Apache and Nginx Run&lt;/h3&gt;
&lt;p&gt;Apache uses a multi-process, process-centered architecture.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Because each request is assigned to a process, many processes start at the same time when a large number of requests arrive, which has the disadvantage of creating very large overhead.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Nginx uses a single-threaded, event-driven architecture.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Like Node.js, it uses an event loop model, where a single thread runs a loop and processes events accumulated in a queue.&lt;/li&gt;
&lt;li&gt;By adopting the event loop model, it can process a large number of requests with only a small number of processes.&lt;/li&gt;
&lt;li&gt;This makes it possible to solve the C10K problem.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;installing-nginx&#34;&gt;Installing Nginx&lt;/h2&gt;
&lt;h3 id=&#34;install-on-mac&#34;&gt;Install on Mac&lt;/h3&gt;
&lt;p&gt;Install using the &lt;code&gt;brew&lt;/code&gt; command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;% brew install nginx
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run the following command and access &lt;code&gt;http://localhost:8080&lt;/code&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;% nginx
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Stop it with the following command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;% nginx -s stop
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The configuration file exists at the following path.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;/usr/local/etc/nginx/nginx.conf
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;install-on-centos&#34;&gt;Install on CentOS&lt;/h3&gt;
&lt;p&gt;Create &lt;code&gt;/etc/yum.repos.d/nginx.repo&lt;/code&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install with the &lt;code&gt;yum&lt;/code&gt; command.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ sudo yum install nginx
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;nginx-commands&#34;&gt;Nginx Commands&lt;/h2&gt;
&lt;h3 id=&#34;start&#34;&gt;Start&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;nginx
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;stop&#34;&gt;Stop&lt;/h3&gt;
&lt;p&gt;CentOS 6, Amazon Linux&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;nginx -s stop
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;CentOS 7, Amazon Linux 2&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;systemctl stop nginx
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;restart&#34;&gt;Restart&lt;/h3&gt;
&lt;p&gt;CentOS 6, Amazon Linux&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;/etc/init.d/nginx restart
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;CentOS 7, Amazon Linux 2&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;systemctl restart nginx
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;register-for-startup&#34;&gt;Register for Startup&lt;/h3&gt;
&lt;p&gt;CentOS 7, Amazon Linux 2&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;systemctl enable nginx # register
systemctl disable nginx # remove
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;reload-configuration&#34;&gt;Reload Configuration&lt;/h3&gt;
&lt;p&gt;CentOS 6, Amazon Linux&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;nginx reload
service nginx reload
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;CentOS 7, Amazon Linux 2&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;systemctl reload nginx
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;check-configuration-file&#34;&gt;Check Configuration File&lt;/h3&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;nginx -t
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;configuration-file-locations&#34;&gt;Configuration File Locations&lt;/h3&gt;
&lt;p&gt;Main configuration file&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cd /etc/nginx/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Per-server configuration files&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;cd /etc/nginx/conf.d/
&lt;/code&gt;&lt;/pre&gt;
      </description>
      
      <category>Nginx</category>
      
    </item>
    
    <item>
      <title>Nginx</title>
      <link>https://www.devkuma.com/en/docs/nginx/</link>
      <pubDate>Wed, 26 May 2021 09:21:39 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/nginx/</guid>
      <description>
        
        
        
      </description>
      
      <category>Nginx</category>
      
      <category>WEB</category>
      
    </item>
    
  </channel>
</rss>
