<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nginx Archives - ServerStadium</title>
	<atom:link href="https://serverstadium.com/knowledge-base/tag/nginx/feed/" rel="self" type="application/rss+xml" />
	<link>https://serverstadium.com/knowledge-base/tag/nginx/</link>
	<description>Public Cloud Solution by ServerStadium</description>
	<lastBuildDate>Fri, 28 Mar 2025 00:24:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>

<image>
	<url>https://serverstadium.com/wp-content/uploads/2023/04/cropped-favicon-1-32x32.png</url>
	<title>nginx Archives - ServerStadium</title>
	<link>https://serverstadium.com/knowledge-base/tag/nginx/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Deploying a LEMP Stack on Ubuntu 22.04 on ServerStadium Dedicated Servers</title>
		<link>https://serverstadium.com/knowledge-base/deploying-lemp-stack-ubuntu2204-dedicated-servers/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Fri, 28 Mar 2025 00:24:04 +0000</pubDate>
				<guid isPermaLink="false">https://serverstadium.com/?post_type=epkb_post_type_1&#038;p=12153</guid>

					<description><![CDATA[<p>Introduction This guide provides step-by-step instructions to deploy a LEMP stack (Linux, Nginx, MySQL, and PHP) on Ubuntu 22.04 using a ServerStadium dedicated server. A LEMP stack is an ideal solution for hosting dynamic websites and web applications, delivering high performance and scalability. Prerequisites Before you begin, ensure you have the following: Deployment Steps 1.&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/deploying-lemp-stack-ubuntu2204-dedicated-servers/">Deploying a LEMP Stack on Ubuntu 22.04 on ServerStadium Dedicated Servers</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Introduction</h2>



<p class="wp-block-paragraph">This guide provides step-by-step instructions to deploy a LEMP stack (Linux, Nginx, MySQL, and PHP) on Ubuntu 22.04 using a <a href="https://serverstadium.com/dedicated-server/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">ServerStadium dedicated server</a>. A LEMP stack is an ideal solution for hosting dynamic websites and web applications, delivering high performance and scalability.</p>



<h2 class="wp-block-heading">Prerequisites</h2>



<p class="wp-block-paragraph">Before you begin, ensure you have the following:</p>



<ul class="wp-block-list">
  
  <li>A <a href="https://serverstadium.com/dedicated-server/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">ServerStadium dedicated server</a> running Ubuntu 22.04.</li>
  
  
  <li>Basic command line knowledge and sudo privileges.</li>
  
  
  <li>An understanding of web server concepts.</li>
  
</ul>



<h2 class="wp-block-heading">Deployment Steps</h2>



<h3 class="wp-block-heading">1. Update Your System</h3>



<p class="wp-block-paragraph">First, update your system to ensure all packages are current:</p>


<pre><code>sudo apt-get update && sudo apt-get upgrade -y</code></pre>


<h3 class="wp-block-heading">2. Install Nginx</h3>



<p class="wp-block-paragraph">Install the Nginx web server:</p>


<pre><code>sudo apt-get install nginx -y</code></pre>


<p class="wp-block-paragraph">After installation, start and enable Nginx:</p>


<pre><code>sudo systemctl start nginx
sudo systemctl enable nginx</code></pre>


<h3 class="wp-block-heading">3. Install MySQL</h3>



<p class="wp-block-paragraph">Install MySQL server for database management:</p>


<pre><code>sudo apt-get install mysql-server -y</code></pre>


<p class="wp-block-paragraph">Secure your MySQL installation:</p>


<pre><code>sudo mysql_secure_installation</code></pre>


<h3 class="wp-block-heading">4. Install PHP</h3>



<p class="wp-block-paragraph">Install PHP and the necessary modules to work with Nginx and MySQL:</p>


<pre><code>sudo apt-get install php-fpm php-mysql -y</code></pre>


<p class="wp-block-paragraph">Verify that PHP is installed by checking the version:</p>


<pre><code>php -v</code></pre>


<h3 class="wp-block-heading">5. Configure Nginx to Use PHP Processor</h3>



<p class="wp-block-paragraph">Edit the default Nginx server block to enable PHP processing. Open the configuration file:</p>


<pre><code>sudo nano /etc/nginx/sites-available/default</code></pre>


<p class="wp-block-paragraph">Modify the file to include the following configuration within the server block. Ensure the location for PHP files is set as shown:</p>


<pre><code>server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;
    index index.php index.html index.htm;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}</code></pre>


<p class="wp-block-paragraph">Save and exit the editor, then test the Nginx configuration for syntax errors:</p>


<pre><code>sudo nginx -t</code></pre>


<p class="wp-block-paragraph">If the test is successful, reload Nginx:</p>


<pre><code>sudo systemctl reload nginx</code></pre>


<h3 class="wp-block-heading">6. Verify Your LEMP Stack Installation</h3>



<p class="wp-block-paragraph">Create a PHP info file to confirm that PHP is processing correctly:</p>


<pre><code>sudo nano /var/www/html/info.php</code></pre>


<p class="wp-block-paragraph">Add the following content to the file:</p>


<pre><code>&lt;?php
phpinfo();
?&gt;</code></pre>


<p class="wp-block-paragraph">Save and exit, then open a web browser and navigate to <code>http://your_server_ip/info.php</code> to view the PHP info page.</p>



<h2 class="wp-block-heading">Post-Deployment Configuration</h2>



<p class="wp-block-paragraph">After deploying the LEMP stack, consider the following enhancements:</p>


<ul class="wp-block-list">
  
  <li>Secure your server by configuring UFW or another firewall to limit access.</li>
  
  
  <li>Optimize PHP and Nginx settings based on your application requirements.</li>
  
  
  <li>Set up regular backups and monitor server performance.</li>
  
</ul>
<!-- /wp:post-content -->

<!-- wp:paragraph {"className":""} -->
<p>Hosting your LEMP stack on a <a href="https://serverstadium.com/dedicated-server/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">ServerStadium dedicated server</a> ensures you benefit from a high-performance, scalable environment for running your web applications.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"className":""} -->
<h2 class="wp-block-heading">Troubleshooting</h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"className":""} -->
<p>If you encounter issues during installation or configuration:</p>
<!-- /wp:paragraph -->

<ul class="wp-block-list">
  <!-- wp:list-item -->
  <li>Ensure all prerequisites are installed and updated.</li>
  <!-- /wp:list-item -->
  <!-- wp:list-item -->
  <li>Review configuration files for Nginx, PHP, and MySQL for any errors.</li>
  <!-- /wp:list-item -->
  <!-- wp:list-item -->
  <li>Consult the logs in <code>/var/log/nginx/</code>, <code>/var/log/mysql/</code>, and <code>/var/log/php/</code> for troubleshooting details.</li>
  <!-- /wp:list-item -->
  <!-- wp:list-item -->
  <li>Refer to our guides in the <a href="https://serverstadium.com/knowledge-base/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">ServerStadium Knowledge Base</a> for additional support.</li>
  <!-- /wp:list-item -->
</ul>
<!-- /wp:list -->

<!-- wp:heading {"className":""} -->
<h2 class="wp-block-heading">Conclusion</h2>
<!-- /wp:heading -->

<!-- wp:paragraph {"className":""} -->
<p>Deploying a LEMP stack on Ubuntu 22.04 on a <a href="https://serverstadium.com/dedicated-server/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">ServerStadium dedicated server</a> provides a robust foundation for hosting dynamic websites and applications. By following this guide, you ensure that your server is optimized for performance and security. For more help or information about ServerStadium services, visit our <a href="https://serverstadium.com/knowledge-base/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">knowledge base</a> or the <a href="https://serverstadium.com/?utm_source=kb&#038;utm_medium=article&#038;utm_campaign=dedicated_server">ServerStadium website</a>.</p>
<!-- /wp:paragraph -->
<p>The post <a href="https://serverstadium.com/knowledge-base/deploying-lemp-stack-ubuntu2204-dedicated-servers/">Deploying a LEMP Stack on Ubuntu 22.04 on ServerStadium Dedicated Servers</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Deploying a Dedicated Instance of OpenResty on ServerStadium Dedicated Servers for Scalable Web Applications</title>
		<link>https://serverstadium.com/knowledge-base/deploying-openresty-dedicated-servers/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Thu, 27 Mar 2025 15:46:47 +0000</pubDate>
				<guid isPermaLink="false">https://serverstadium.com/?post_type=epkb_post_type_1&#038;p=12114</guid>

					<description><![CDATA[<p>Introduction This guide explains how to deploy a dedicated instance of OpenResty—a high-performance web platform based on Nginx—on a ServerStadium VM or a dedicated server. OpenResty is ideal for scalable web applications that demand fast performance and efficient handling of high traffic. With our robust hosting infrastructure, you can run OpenResty with confidence, ensuring reliability&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/deploying-openresty-dedicated-servers/">Deploying a Dedicated Instance of OpenResty on ServerStadium Dedicated Servers for Scalable Web Applications</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Introduction</h2>



<p class="wp-block-paragraph">This guide explains how to deploy a dedicated instance of OpenResty—a high-performance web platform based on Nginx—on a <a href="https://serverstadium.com">ServerStadium VM</a> or a <a href="https://serverstadium.com/dedicated-server/">dedicated server</a>. OpenResty is ideal for scalable web applications that demand fast performance and efficient handling of high traffic. With our robust hosting infrastructure, you can run OpenResty with confidence, ensuring reliability and speed for your critical web services.</p>



<h2 class="wp-block-heading">Prerequisites</h2>



<p class="wp-block-paragraph">Before proceeding, ensure you have the following:</p>



<ul class="wp-block-list">
  
  <li>A <a href="https://serverstadium.com">ServerStadium VM</a> or <a href="https://serverstadium.com/dedicated-server/">dedicated server</a> running Ubuntu or a similar Linux distribution.</li>
  
  
  <li>Basic command line knowledge and sudo privileges.</li>
  
  
  <li>Familiarity with Nginx and Lua (as OpenResty integrates both).</li>
  
  
  <li>A solid network configuration and firewall settings in place.</li>
  
</ul>



<h2 class="wp-block-heading">Installation Steps</h2>



<h3 class="wp-block-heading">1. Update Your System</h3>



<p class="wp-block-paragraph">Keep your server updated to ensure optimal performance and security. Open your terminal and run:</p>


<pre><code>sudo apt-get update && sudo apt-get upgrade -y</code></pre>


<h3 class="wp-block-heading">2. Install Dependencies</h3>



<p class="wp-block-paragraph">Install required packages, including build tools and libraries:</p>


<pre><code>sudo apt-get install -y libpcre3 libpcre3-dev libssl-dev perl make build-essential curl</code></pre>


<h3 class="wp-block-heading">3. Download and Install OpenResty</h3>



<p class="wp-block-paragraph">Download the latest stable version of OpenResty from the official source and extract it. Navigate to your desired installation directory (e.g., <code>/usr/local/src</code>):</p>


<pre><code>cd /usr/local/src
sudo wget https://openresty.org/download/openresty-1.21.4.1.tar.gz -O openresty.tar.gz</code></pre>


<p class="wp-block-paragraph">Extract the package:</p>


<pre><code>sudo tar -xzvf openresty.tar.gz</code></pre>


<p class="wp-block-paragraph">Navigate into the extracted directory:</p>


<pre><code>cd openresty-1.21.4.1</code></pre>


<p class="wp-block-paragraph">Configure, compile, and install OpenResty:</p>


<pre><code>sudo ./configure
sudo make
sudo make install</code></pre>


<h3 class="wp-block-heading">4. Configure OpenResty</h3>



<p class="wp-block-paragraph">Create a basic configuration file to set up OpenResty. The default installation typically places configuration files in <code>/usr/local/openresty/nginx/conf/nginx.conf</code>. Open the file in your preferred editor:</p>


<pre><code>sudo nano /usr/local/openresty/nginx/conf/nginx.conf</code></pre>


<p class="wp-block-paragraph">Ensure that the configuration meets your application requirements. Adjust server names, ports, or add Lua scripts as needed for your scalable web application. Save and exit the editor when done.</p>



<h3 class="wp-block-heading">5. Start OpenResty</h3>



<p class="wp-block-paragraph">Start the OpenResty service to launch Nginx with your new configuration:</p>


<pre><code>sudo /usr/local/openresty/nginx/sbin/nginx</code></pre>


<p class="wp-block-paragraph">To verify that OpenResty is running, you can check the service status or navigate to your server&#8217;s IP address in your browser.</p>



<h3 class="wp-block-heading">6. Set Up OpenResty as a Service (Optional)</h3>



<p class="wp-block-paragraph">For easier management, configure OpenResty to run as a service. Create a new systemd service file:</p>


<pre><code>sudo nano /etc/systemd/system/openresty.service</code></pre>


<p class="wp-block-paragraph">Insert the following configuration into the file:</p>


<pre><code>[Unit]
Description=OpenResty
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/openresty/nginx/sbin/nginx
ExecReload=/usr/local/openresty/nginx/sbin/nginx -s reload
ExecStop=/usr/local/openresty/nginx/sbin/nginx -s quit
PIDFile=/usr/local/openresty/nginx/logs/nginx.pid
Restart=always

[Install]
WantedBy=multi-user.target</code></pre>


<p class="wp-block-paragraph">Enable and start the OpenResty service:</p>


<pre><code>sudo systemctl enable openresty
sudo systemctl start openresty</code></pre>


<h2 class="wp-block-heading">Post-Installation Configuration</h2>



<p class="wp-block-paragraph">After installation, tailor your OpenResty configuration to suit your web application&#8217;s needs. Consider:</p>



<ul class="wp-block-list">
  
  <li>Adjusting caching and load balancing settings.</li>
  
  
  <li>Configuring Lua modules to extend application functionality.</li>
  
  
  <li>Optimizing performance and security parameters.</li>
  
</ul>



<p class="wp-block-paragraph">ServerStadium’s dedicated hosting infrastructure ensures that your OpenResty instance runs on high-performance hardware, providing the scalability and reliability required for demanding web applications.</p>



<h2 class="wp-block-heading">Troubleshooting</h2>



<p class="wp-block-paragraph">If you encounter issues during installation or configuration, consider the following steps:</p>



<ul class="wp-block-list">
  
  <li>Verify that all system dependencies and prerequisites are installed correctly.</li>
  
  
  <li>Check the OpenResty error logs, typically located in <code>/usr/local/openresty/nginx/logs/</code>, for diagnostic information.</li>
  
  
  <li>Review your configuration file for syntax errors.</li>
  
  
  <li>Consult our comprehensive guides in the <a href="https://serverstadium.com/knowledge-base/">ServerStadium Knowledge Base</a> for additional support.</li>
  
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p class="wp-block-paragraph">Deploying OpenResty on a ServerStadium dedicated server delivers a scalable, high-performance platform for your web applications. Leverage our robust hosting solutions to ensure reliable, secure, and efficient service for your mission-critical projects. For more help or information about ServerStadium services, visit our <a href="https://serverstadium.com/knowledge-base/">knowledge base</a> or the <a href="https://serverstadium.com">ServerStadium website</a>.</p>

<p>The post <a href="https://serverstadium.com/knowledge-base/deploying-openresty-dedicated-servers/">Deploying a Dedicated Instance of OpenResty on ServerStadium Dedicated Servers for Scalable Web Applications</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Hosting Ghost CMS for High-Performance Blogging Platforms on Server Stadium Instant Dedicated Servers and Cloud VMs</title>
		<link>https://serverstadium.com/knowledge-base/hosting-ghost-cms-for-high-performance-blogging-platforms/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Thu, 19 Sep 2024 21:49:59 +0000</pubDate>
				<guid isPermaLink="false">https://serverstadium.com/?post_type=epkb_post_type_1&#038;p=12056</guid>

					<description><![CDATA[<p>Introduction In the competitive world of online content, having a high-performance blogging platform is crucial for engaging readers and boosting search engine rankings. Ghost CMS is a powerful, open-source platform designed for professional publishing. This guide will walk you through hosting Ghost CMS for high-performance blogging using Server Stadium&#8217;s robust infrastructure, leveraging our Cloud VMs&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/hosting-ghost-cms-for-high-performance-blogging-platforms/">Hosting Ghost CMS for High-Performance Blogging Platforms on Server Stadium Instant Dedicated Servers and Cloud VMs</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3>Introduction</h3>
<p>In the competitive world of online content, having a high-performance blogging platform is crucial for engaging readers and boosting search engine rankings. <strong>Ghost CMS</strong> is a powerful, open-source platform designed for professional publishing. This guide will walk you through hosting Ghost CMS for high-performance blogging using <strong>Server Stadium&#8217;s</strong> robust infrastructure, leveraging our <a href="https://serverstadium.com/pricing/" target="_new" rel="noopener">Cloud VMs</a> and <a href="https://serverstadium.com/dedicated-server/" target="_new" rel="noopener">Instant Dedicated Servers</a> to deliver fast, reliable, and scalable blogging platforms.</p>
<h3>Why Choose Ghost CMS?</h3>
<p>Ghost CMS is a modern publishing platform built on Node.js, offering:</p>
<ul>
<li><strong>Performance</strong>: Optimized for speed, ensuring quick load times.</li>
<li><strong>SEO-Friendly</strong>: Built-in SEO features to improve search engine rankings.</li>
<li><strong>Customization</strong>: Extensive theming options and integrations.</li>
<li><strong>Simplicity</strong>: User-friendly interface for content creators.</li>
</ul>
<h3>Prerequisites</h3>
<ul>
<li>Access to Server Stadium <a href="https://serverstadium.com/pricing/" target="_new" rel="noopener">Cloud VMs</a> or <a href="https://serverstadium.com/dedicated-server/" target="_new" rel="noopener">Instant Dedicated Servers</a>. If you don&#8217;t have an account, <a href="https://cp.serverstadium.com/regist-user" target="_new" rel="noopener">sign up here</a>.</li>
<li>A domain name pointed to your server&#8217;s IP address.</li>
<li>Servers running Ubuntu 20.04 LTS or later.</li>
<li>Root or sudo access to the server.</li>
<li>Basic knowledge of command-line operations.</li>
</ul>
<h3>Step 1: Provision Your Server Infrastructure</h3>
<ol>
<li><strong>Choose Your Server Type</strong>:
<ul>
<li><strong>Cloud VMs</strong>: Ideal for small to medium blogs with moderate traffic.</li>
<li><strong>Instant Dedicated Servers</strong>: Best for high-traffic blogs requiring maximum performance. Instantly deploy your server without waiting times.</li>
</ul>
</li>
<li><strong>Select Server Specifications</strong>:
<ul>
<li><strong>CPU</strong>: Multi-core processors for handling multiple requests.</li>
<li><strong>Memory</strong>: At least 4GB RAM is recommended for Ghost CMS.</li>
<li><strong>Storage</strong>: SSD or NVMe drives for faster data access.</li>
<li><strong>Network</strong>: High bandwidth and low latency connections.</li>
</ul>
</li>
</ol>
<h3>Step 2: Update Your Server</h3>
<p>Keep your server up-to-date with the latest security patches.</p>
<p><div class="shortcode-code">
<p> sudo apt update sudo apt upgrade -y </p></div></p>
<h3>Step 3: Install Node.js and npm</h3>
<p>Ghost CMS requires Node.js version 20.x.</p>
<h4>1. Install Node.js</h4>
<p><div class="shortcode-code">
<p> curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash &#8211; sudo apt install -y nodejs </p></div></p>
<p>Verify the installation:</p>
<p><div class="shortcode-code">
<p> node -v npm -v </p></div></p>
<h3>Step 4: Install MySQL</h3>
<p>Ghost CMS uses MySQL as its database.</p>
<p><div class="shortcode-code">
<p> sudo apt install mysql-server -y </p></div></p>
<p>Secure the MySQL installation:</p>
<p><div class="shortcode-code">
<p> sudo mysql_secure_installation </p></div></p>
<p>Follow the prompts to set the root password and secure your database.</p>
<h3>Step 5: Create a MySQL Database and User for Ghost</h3>
<p>Log in to MySQL:</p>
<p><div class="shortcode-code">
<p> sudo mysql -u root -p </p></div></p>
<p>Inside the MySQL shell, run:</p>
<p><div class="shortcode-code">
<p> CREATE DATABASE ghost_db; CREATE USER &#039;ghost_user&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;your_strong_password&#039;; GRANT ALL PRIVILEGES ON ghost_db.* TO &#039;ghost_user&#039;@&#039;localhost&#039;; FLUSH PRIVILEGES; EXIT; </p></div></p>
<h3>Step 6: Install Nginx</h3>
<p>Nginx will serve as a reverse proxy for Ghost.</p>
<p><div class="shortcode-code">
<p> sudo apt install nginx -y </p></div></p>
<h3>Step 7: Install Ghost-CLI</h3>
<p>Ghost-CLI is a command-line tool that installs and manages Ghost.</p>
<p><div class="shortcode-code">
<p> sudo npm install -g ghost-cli@latest </p></div></p>
<h3>Step 8: Set Up Your Ghost Directory</h3>
<p>Create a directory for your Ghost installation and set the appropriate permissions.</p>
<p><div class="shortcode-code">
<p> sudo mkdir -p /var/www/ghost sudo chown $USER:$USER /var/www/ghost sudo chmod 775 /var/www/ghost cd /var/www/ghost </p></div></p>
<h3>Step 9: Install Ghost CMS</h3>
<p>Run the Ghost installation command.</p>
<p><div class="shortcode-code">
<p> ghost install </p></div></p>
<p>During the installation, you&#8217;ll be prompted for configuration options:</p>
<ul>
<li><strong>Blog URL</strong>: Enter your domain name (e.g., <code>https://yourdomain.com</code>).</li>
<li><strong>MySQL configuration</strong>: Use the database name, user, and password you set earlier.</li>
<li><strong>Set up Nginx</strong>: Yes.</li>
<li><strong>Set up SSL</strong>: Yes (recommended to use Let&#8217;s Encrypt).</li>
<li><strong>Set up systemd</strong>: Yes.</li>
<li><strong>Start Ghost</strong>: Yes.</li>
</ul>
<h3>Step 10: Adjust Firewall Settings</h3>
<p>Allow Nginx Full profile through the firewall.</p>
<p><div class="shortcode-code">
<p> sudo ufw allow &#039;Nginx Full&#039; sudo ufw enable </p></div></p>
<h3>Step 11: Access Your Ghost Blog</h3>
<p>Open your web browser and navigate to your domain to see your new Ghost blog.</p>
<p>To access the admin interface, go to:</p>
<p><div class="shortcode-code">
<p> https://yourdomain.com/ghost/ </p></div></p>
<h3>Benefits of Using Server Stadium for Hosting Ghost CMS</h3>
<ul>
<li><strong>High-Performance Hardware</strong>: Latest CPUs and fast NVMe storage for quick content delivery.</li>
<li><strong>Scalability</strong>: Easily scale resources as your blog grows.</li>
<li><strong>Instant Deployment</strong>: Get your dedicated servers up and running instantly.</li>
<li><strong>Global Network</strong>: Low-latency connections for faster page loads.</li>
<li><strong>24/7 Support</strong>: Expert assistance whenever you need it.</li>
</ul>
<h3>Optimizing Ghost CMS for High Performance</h3>
<h4>1. Enable Caching</h4>
<p>Use Nginx caching to improve load times.</p>
<h4>2. Use a Content Delivery Network (CDN)</h4>
<p>Integrate a CDN to serve static assets faster.</p>
<h4>3. Optimize Images</h4>
<p>Use image optimization tools or services to reduce image sizes without compromising quality.</p>
<h4>4. Regular Updates</h4>
<p>Keep Ghost CMS and all packages up-to-date for security and performance enhancements.</p>
<h3>Why Choose Ghost CMS for Blogging?</h3>
<ul>
<li><strong>SEO-Friendly</strong>: Built-in SEO tools help improve your search engine rankings.</li>
<li><strong>Responsive Design</strong>: Themes are mobile-friendly, enhancing user experience.</li>
<li><strong>Content Focused</strong>: Minimalistic design keeps the focus on your content.</li>
<li><strong>Community Support</strong>: Active community and extensive documentation.</li>
</ul>
<h3>Conclusion</h3>
<p>Hosting Ghost CMS on Server Stadium&#8217;s Instant Dedicated Servers or Cloud VMs provides a high-performance platform for your blogging needs. With our robust infrastructure and Ghost&#8217;s powerful features, you can efficiently deliver engaging content to your audience.</p>
<p><strong>Ready to launch your high-performance blog?</strong> Explore our <a href="https://serverstadium.com/pricing/" target="_new" rel="noopener">Cloud VM pricing</a> or <a href="https://serverstadium.com/dedicated-server/" target="_new" rel="noopener">Instant Dedicated Server options</a></p>
<p>The post <a href="https://serverstadium.com/knowledge-base/hosting-ghost-cms-for-high-performance-blogging-platforms/">Hosting Ghost CMS for High-Performance Blogging Platforms on Server Stadium Instant Dedicated Servers and Cloud VMs</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Deploying Python Applications with uWSGI and Nginx on Server Stadium</title>
		<link>https://serverstadium.com/knowledge-base/deploying-python-applications-with-uwsgi-and-nginx/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Fri, 24 May 2024 16:58:45 +0000</pubDate>
				<guid isPermaLink="false">https://serverstadium.com/?post_type=epkb_post_type_1&#038;p=11941</guid>

					<description><![CDATA[<p>Introduction Deploying Python web applications efficiently and securely is crucial for maintaining performance and scalability. Using uWSGI with Nginx is a popular method for serving Python applications, providing robust handling of client requests and serving content quickly. This guide details how to deploy a Python application using uWSGI and Nginx on a Server Stadium dedicated&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/deploying-python-applications-with-uwsgi-and-nginx/">Deploying Python Applications with uWSGI and Nginx on Server Stadium</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3>Introduction</h3>
<p>Deploying Python web applications efficiently and securely is crucial for maintaining performance and scalability. Using uWSGI with Nginx is a popular method for serving Python applications, providing robust handling of client requests and serving content quickly. This guide details how to deploy a Python application using uWSGI and Nginx on a Server Stadium <a href="https://serverstadium.com/dedicated-server/" target="_new" rel="noreferrer noopener">dedicated server</a> or VM.</p>
<h3>Prerequisites</h3>
<ul>
<li>A Server Stadium <a href="https://serverstadium.com/pricing/" target="_new" rel="noreferrer noopener">VM</a> or <a href="https://serverstadium.com/dedicated-server/" target="_new" rel="noreferrer noopener">dedicated server</a> running Ubuntu 20.04 LTS or 22.04 LTS. If you do not have one, <a href="https://cp.serverstadium.com/regist-user" target="_new" rel="noreferrer noopener">sign up here</a>.</li>
<li>Administrative or sudo privileges on your server.</li>
<li>A Python application ready to be deployed.</li>
</ul>
<h3>Step 1: Install Python, Nginx, and uWSGI</h3>
<ol>
<li><strong>Update Your Server&#8217;s Package Index</strong><br />
Start by updating your server&#8217;s packages:<br />
<div class="shortcode-code">
<p> sudo apt update<br />
sudo apt upgrade<br />
</p></div></li>
<li><strong>Install Python</strong><br />
Install Python and pip:<br />
<div class="shortcode-code">
<p> sudo apt install python3 python3-pip<br />
</p></div></li>
<li><strong>Install Nginx</strong><br />
Install Nginx using apt:<br />
<div class="shortcode-code">
<p> sudo apt install nginx<br />
</p></div></li>
<li><strong>Install uWSGI</strong><br />
Install uWSGI globally using pip:<br />
<div class="shortcode-code">
<p> sudo pip3 install uwsgi<br />
</p></div></li>
</ol>
<h3>Step 2: Configure uWSGI</h3>
<ol>
<li><strong>Create uWSGI Configuration File</strong><br />
Set up a configuration file for your application in <code>/etc/uwsgi/sites</code>:<br />
<div class="shortcode-code">
<p> &#091;uwsgi&#093;<br />
module = wsgi:app<br />
master = true<br />
processes = 5<br />
socket = myapp.sock<br />
chmod-socket = 660<br />
vacuum = true<br />
die-on-term = true<br />
</p></div></li>
<li><strong>Create a Systemd Unit File for uWSGI</strong><br />
Create a service file to manage uWSGI:<br />
<div class="shortcode-code">
<p> &#091;Unit&#093;<br />
Description=uWSGI Emperor service</p>
<p>&#091;Service&#093;<br />
ExecStart=/usr/local/bin/uwsgi &#8211;emperor /etc/uwsgi/sites<br />
Restart=always<br />
KillSignal=SIGQUIT<br />
Type=notify<br />
NotifyAccess=all</p>
<p>&#091;Install&#093;<br />
WantedBy=multi-user.target<br />
</p></div></li>
</ol>
<h3>Step 3: Configure Nginx</h3>
<ol>
<li><strong>Create an Nginx Server Block</strong><br />
Configure Nginx to forward requests to uWSGI:<br />
<div class="shortcode-code">
<p> server {<br />
listen 80;<br />
server_name myserver.com;</p>
<p>location / {<br />
include uwsgi_params;<br />
uwsgi_pass unix:/path/to/your/myapp.sock;<br />
}<br />
}<br />
</p></div></li>
<li><strong>Enable the Nginx Configuration</strong><br />
Enable the site and restart Nginx:<br />
<div class="shortcode-code">
<p> sudo ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled<br />
sudo nginx -t<br />
sudo systemctl restart nginx<br />
</p></div></li>
</ol>
<h3>Step 4: Deploy Your Application</h3>
<ol>
<li><strong>Start uWSGI Service</strong><br />
Enable and start the uWSGI service:<br />
<div class="shortcode-code">
<p> sudo systemctl start uwsgi<br />
sudo systemctl enable uwsgi<br />
</p></div></li>
</ol>
<h3>Conclusion</h3>
<p>Deploying your Python application with uWSGI and Nginx on Server Stadium provides a robust, scalable environment for web applications. This setup ensures that your application can handle a high number of requests efficiently and reliably.</p>
<p>For further assistance or to explore more about our hosting solutions, visit our <a href="https://serverstadium.com/knowledge-base/" target="_new" rel="noreferrer noopener">knowledge base</a> or the <a href="https://serverstadium.com/" target="_new" rel="noreferrer noopener">Server Stadium website</a>.</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/deploying-python-applications-with-uwsgi-and-nginx/">Deploying Python Applications with uWSGI and Nginx on Server Stadium</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Setting Up a Node.js Application Using Docker and Nginx on ServerStadium</title>
		<link>https://serverstadium.com/knowledge-base/setting-up-a-node-js-application-using-docker-and-nginx-on-serverstadium/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Thu, 04 Jan 2024 02:28:28 +0000</pubDate>
				<guid isPermaLink="false">https://serverstadium.com/?post_type=epkb_post_type_1&#038;p=11762</guid>

					<description><![CDATA[<p>This tutorial guides you through creating a secure and scalable environment for a Node.js application using Docker and Nginx on ServerStadium&#8217;s infrastructure. Prerequisites A ServerStadium VM or dedicated server. Review the options at ServerStadium VM Pricing and Dedicated Servers. Basic knowledge of Docker, Nginx, and Node.js. Step 1: Prepare Your ServerStadium Environment Select and Set&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/setting-up-a-node-js-application-using-docker-and-nginx-on-serverstadium/">Setting Up a Node.js Application Using Docker and Nginx on ServerStadium</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This tutorial guides you through creating a secure and scalable environment for a Node.js application using Docker and Nginx on ServerStadium&#8217;s infrastructure.</p>
<h3>Prerequisites</h3>
<ul>
<li>A ServerStadium VM or dedicated server. Review the options at <a href="https://serverstadium.com/pricing/" target="_new" rel="noopener">ServerStadium VM Pricing</a> and <a href="https://serverstadium.com/dedicated-server/" target="_new" rel="noopener">Dedicated Servers</a>.</li>
<li>Basic knowledge of Docker, Nginx, and Node.js.</li>
</ul>
<h3>Step 1: Prepare Your ServerStadium Environment</h3>
<ol>
<li><strong>Select and Set Up Your Server</strong>: Choose a VM or dedicated server from ServerStadium. A medium-sized VM should suffice for most Node.js applications.</li>
<li><strong>Server Setup</strong>: Access your server via SSH. Update the system:<br />
<div class="shortcode-code">
<p>sudo apt update<br />
sudo apt upgrade</p></div></li>
</ol>
<h3>Step 2: Install Docker</h3>
<ol>
<li><strong>Install Docker</strong>: Install Docker on your ServerStadium environment:<br />
<div class="shortcode-code">
<p>sudo apt install docker.io</p></div></li>
<li><strong>Start and Enable Docker</strong>:<br />
<div class="shortcode-code">
<p>sudo systemctl start docker<br />
sudo systemctl enable docker</p></div></li>
<li><strong>Verify Installation</strong>:<br />
<div class="shortcode-code">
<p>docker &#8211;version</p></div></li>
</ol>
<h3>Step 3: Create Your Node.js Application</h3>
<ol>
<li><strong>Application Setup</strong>: On your local machine, create a basic Node.js application. For example, an Express.js application.</li>
<li><strong>Dockerize the Application</strong>: Create a <code>Dockerfile</code> in your application directory:
<p><div class="shortcode-code">
<p>FROM node:14</p>
<p>WORKDIR /usr/src/app</p>
<p>COPY package*.json ./</p>
<p>RUN npm install</p>
<p>COPY . .</p>
<p>EXPOSE 8080</p>
<p>CMD &#091; &quot;node&quot;, &quot;app.js&quot; &#093;</p>
<p></p></div></li>
<li><strong>Build Your Docker Image</strong>:<br />
<div class="shortcode-code">
<p>docker build -t mynodeapp .</p></div></li>
<li><strong>Run the Docker Container</strong>:<br />
<div class="shortcode-code">
<p>docker run -d -p 8080:8080 mynodeapp</p></div></li>
</ol>
<h3>Step 4: Install and Configure Nginx as a Reverse Proxy</h3>
<ol>
<li><strong>Install Nginx</strong>:<br />
<div class="shortcode-code">
<p>sudo apt install nginx</p></div></li>
<li><strong>Configure Nginx</strong>:
<p>Create a new site configuration file:<br />
<div class="shortcode-code">
<p>sudo nano /etc/nginx/sites-available/mynodeapp</p></div><br />
Add the following configuration:</p>
<p><div class="shortcode-code">
<p>server {<br />
listen 80;</p>
<p>server_name your_domain.com;</p>
<p>location / {<br />
proxy_pass http://localhost:8080;<br />
proxy_http_version 1.1;<br />
proxy_set_header Upgrade $http_upgrade;<br />
proxy_set_header Connection &#039;upgrade&#039;;<br />
proxy_set_header Host $host;<br />
proxy_cache_bypass $http_upgrade;<br />
}<br />
}</p>
<p></p></div><br />
Enable the new site:<br />
<div class="shortcode-code">
<p>sudo ln -s /etc/nginx/sites-available/mynodeapp /etc/nginx/sites-enabled/<br />
sudo nginx -t<br />
sudo systemctl restart nginx</p></div></li>
<li><strong>Firewall Configuration</strong>: If you have a firewall enabled, allow Nginx traffic:<br />
<div class="shortcode-code">
<p>sudo ufw allow &lt;span class=&quot;hljs-string&quot;&gt;&#039;Nginx Full&#039;&lt;/span&gt;</p></div></li>
</ol>
<h3>Step 5: Deploy Your Application</h3>
<ol>
<li><strong>Transfer Your Docker Image</strong>: Use <code>docker save</code> and <code>docker load</code> or a Docker registry to transfer your Docker image to your ServerStadium server.</li>
<li><strong>Run Your Docker Container</strong>: On the server, run your Docker container as before.</li>
</ol>
<h3>Step 6: Secure Your Application</h3>
<ol>
<li><strong>SSL Certificate</strong>: Obtain an SSL certificate for your domain (you can use Let&#8217;s Encrypt for a free certificate) and configure Nginx to use it.</li>
<li><strong>Environment Variables</strong>: Use environment variables for sensitive information like database passwords.</li>
</ol>
<h3>Conclusion</h3>
<p>You now have a scalable and secure Node.js application running in a Docker container, with Nginx as a reverse proxy on a ServerStadium server. This setup ensures efficient load handling and enhanced security for your application.</p>
<p>For additional assistance, visit our <a href="https://serverstadium.com/knowledge-base/" target="_new" rel="noopener">knowledge base</a> or contact our support team.</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/setting-up-a-node-js-application-using-docker-and-nginx-on-serverstadium/">Setting Up a Node.js Application Using Docker and Nginx on ServerStadium</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Making Your Django Project Production-Ready on Ubuntu 22.04: Gunicorn and Nginx Setup</title>
		<link>https://serverstadium.com/knowledge-base/making-your-django-project-production-ready-on-ubuntu-22-04-gunicorn-and-nginx-setup/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Thu, 04 Jan 2024 01:35:52 +0000</pubDate>
				<guid isPermaLink="false">https://serverstadium.com/?post_type=epkb_post_type_1&#038;p=11751</guid>

					<description><![CDATA[<p>This continuation of our guide will show you how to make your Django project production-ready on a ServerStadium VM using Gunicorn and Nginx. Step 8: Install and Configure Gunicorn Install Gunicorn with pip: Test Gunicorn&#8217;s ability to serve the project: Now, visit http://your_server_ip:8000 to confirm it’s serving your Django site correctly. Step 9: Create a&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/making-your-django-project-production-ready-on-ubuntu-22-04-gunicorn-and-nginx-setup/">Making Your Django Project Production-Ready on Ubuntu 22.04: Gunicorn and Nginx Setup</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This continuation of our guide will show you how to make your Django project production-ready on a ServerStadium VM using Gunicorn and Nginx.</p>
<h3>Step 8: Install and Configure Gunicorn</h3>
<p>Install Gunicorn with pip:</p>
<p><div class="shortcode-code">
<p>pip3 install gunicorn</p></div></p>
<p>Test Gunicorn&#8217;s ability to serve the project:</p>
<p><div class="shortcode-code">
<p>gunicorn &#8211;workers 3 myproject.wsgi:application &#8211;&lt;span class=&quot;hljs-built_in&quot;&gt;bind&lt;/span&gt; 0.0.0.0:8000</p></div></p>
<p>Now, visit <code>http://your_server_ip:8000</code> to confirm it’s serving your Django site correctly.</p>
<h3>Step 9: Create a Gunicorn Systemd Service File</h3>
<p>Create a systemd service file for Gunicorn to manage your process:</p>
<div class="bg-black rounded-md">
<div class="p-4 overflow-y-auto"><div class="shortcode-code">
<p>sudo nano /etc/systemd/system/gunicorn.service</p></div></p></div>
<div></div>
</div>
<p>Add the following content, adjusting paths and usernames as necessary:</p>
<div class="bg-black rounded-md">
<div class="flex items-center relative text-gray-200 bg-gray-800 dark:bg-token-surface-primary px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div>
<div class="p-4 overflow-y-auto">
<p><div class="shortcode-code">
<p>&#091;Unit&#093;<br />
Description=gunicorn daemon<br />
Requires=gunicorn.socket<br />
After=network.target</p>
<p>&#091;Service&#093;<br />
User=yourusername<br />
Group=www-data<br />
WorkingDirectory=/home/yourusername/mydjangoapp<br />
ExecStart=/home/yourusername/mydjangoapp/env/bin/gunicorn \<br />
&#8211;access-logfile &#8211; \<br />
&#8211;workers 3 \<br />
&#8211;bind unix:/run/gunicorn.sock \<br />
myproject.wsgi:application</p>
<p>&#091;Install&#093;<br />
WantedBy=multi-user.target</p>
<p></p></div></p>
</div>
</div>
<p>Enable and start the Gunicorn service:</p>
<div class="bg-black rounded-md">
<div class="p-4 overflow-y-auto"><div class="shortcode-code">
<p>sudo systemctl start gunicorn&lt;/div&gt;<br />
&lt;div class=&quot;p-4 overflow-y-auto&quot;&gt;sudo systemctl &lt;span class=&quot;hljs-built_in&quot;&gt;enable&lt;/span&gt; gunicorn</p></div></p></div>
</div>
<h3>Step 10: Install and Configure Nginx</h3>
<p>Install Nginx:</p>
<div class="bg-black rounded-md">
<div class="p-4 overflow-y-auto"><div class="shortcode-code">
<p>sudo apt install nginx</p></div></p></div>
<div></div>
</div>
<p>Configure Nginx to proxy pass to Gunicorn. Create a new server block:</p>
<div class="bg-black rounded-md">
<div class="p-4 overflow-y-auto"><div class="shortcode-code">
<p>sudo nano /etc/nginx/sites-available/mydjangoapp</p></div></p></div>
</div>
<p>Add the following configuration:</p>
<div class="bg-black rounded-md">
<div class="flex items-center relative text-gray-200 bg-gray-800 dark:bg-token-surface-primary px-4 py-2 text-xs font-sans justify-between rounded-t-md">
<p><div class="shortcode-code">
<p>server {<br />
listen 80;<br />
server_name your_server_ip;</p>
<p>location = /favicon.ico { access_log off; log_not_found off; }<br />
location /static/ {<br />
root /home/yourusername/mydjangoapp;<br />
}</p>
<p>location / {<br />
include proxy_params;<br />
proxy_pass http://unix:/run/gunicorn.sock;<br />
}<br />
}</p>
<p></p></div></p>
</div>
</div>
<div class="bg-black rounded-md">
<div class="flex items-center relative text-gray-200 bg-gray-800 dark:bg-token-surface-primary px-4 py-2 text-xs font-sans justify-between rounded-t-md">Link this file to the <code>sites-enabled</code> directory:</div>
<div></div>
<div class="p-4 overflow-y-auto"><div class="shortcode-code">
<p>sudo &lt;span class=&quot;hljs-built_in&quot;&gt;ln&lt;/span&gt; -s /etc/nginx/sites-available/mydjangoapp /etc/nginx/sites-enabled</p></div></p></div>
<div></div>
</div>
<p>Test your Nginx configuration:</p>
<div class="bg-black rounded-md">
<div class="p-4 overflow-y-auto"><div class="shortcode-code">
<p>sudo nginx -t</p></div></p></div>
<div></div>
</div>
<p>Restart Nginx:</p>
<div class="bg-black rounded-md">
<div class="p-4 overflow-y-auto"><div class="shortcode-code">
<p>sudo systemctl restart nginx</p></div></p></div>
</div>
<h3>Step 11: Secure Your Server with a Firewall</h3>
<p>Enable the Nginx Full profile on <code>ufw</code>:</p>
<div class="bg-black rounded-md">
<div class="p-4 overflow-y-auto"><div class="shortcode-code">
<p>sudo ufw allow &lt;span class=&quot;hljs-string&quot;&gt;&#039;Nginx Full&#039;&lt;/span&gt;</p></div></p></div>
</div>
<h3>Conclusion</h3>
<p>Your Django application is now configured with Gunicorn and Nginx on your <a href="https://cp.serverstadium.com/" target="_new" rel="noopener">ServerStadium VM</a>, ready for production.</p>
<p>For additional support, check out our <a href="https://serverstadium.com/knowledge-base/" target="_new" rel="noopener">knowledge base</a> or contact our support team.</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/making-your-django-project-production-ready-on-ubuntu-22-04-gunicorn-and-nginx-setup/">Making Your Django Project Production-Ready on Ubuntu 22.04: Gunicorn and Nginx Setup</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Deploy Django App on ServerStadium VM Using Gunicorn, Supervisor, and Nginx</title>
		<link>https://serverstadium.com/knowledge-base/how-to-deploy-django-app-on-serverstadium-vm-using-gunicorn-supervisor-and-nginx/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Sat, 11 Jun 2022 07:11:17 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=2084</guid>

					<description><![CDATA[<p>A basic guide on deploying the Django app using Gunicorn, Supervisor, and Nginx stack on your ServerStadium VM instance. In this article, I will use Ubuntu 22.04 LTS as the deployment server, Python 3.8, and Django 4.0. TLDR Create a standard user called apps Install supervisor and Nginx Install your App&#8217;s Python version. Install pip&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/how-to-deploy-django-app-on-serverstadium-vm-using-gunicorn-supervisor-and-nginx/">How to Deploy Django App on ServerStadium VM Using Gunicorn, Supervisor, and Nginx</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">A basic guide on deploying the Django app using Gunicorn, Supervisor, and Nginx stack on your ServerStadium VM instance.</p>



<p class="wp-block-paragraph">In this article, I will use Ubuntu 22.04 LTS as the deployment server, Python 3.8, and Django 4.0.</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">TLDR</h2>



<ol class="wp-block-list">
<li>Create a standard user called <strong>apps</strong></li>
<li>Install supervisor and Nginx</li>
</ol>



<pre class="wp-block-code"><code>sudo apt install supervisor nginx -y</code></pre>



<ol class="wp-block-list" start="3">
<li>Install your App&#8217;s Python version.</li>
<li>Install <code>pip</code></li>
<li>Install <code>pipenv</code> globally.</li>
</ol>



<pre class="wp-block-code"><code>sudo pip install pipenv</code></pre>



<ol class="wp-block-list" start="3">
<li>Add your server IP and/or FQDN address to ALLOWED_HOSTS in <code>settings.py</code> file</li>
</ol>



<pre class="wp-block-code"><code>ALLOWED_HOSTS = [ "xx.yy.dd.zz", "your.domain.tld" ]</code></pre>



<ol class="wp-block-list" start="4">
<li>Copy the Django app to <code>/home/apps/django-app</code></li>
<li>Go to the app folder and run:</li>
</ol>



<pre class="wp-block-code"><code>cd /home/apps/django-app
python3.8 -m pipenv install --deploy</code></pre>



<ol class="wp-block-list" start="6">
<li>Install Gunicorn using pipenv on the same directory</li>
</ol>



<pre class="wp-block-code"><code>python3.8 -m pipenv install gunicorn</code></pre>



<ol class="wp-block-list" start="7">
<li>Create supervisor config file under <code>/etc/supervisor/conf.d/django-app.conf</code></li>
</ol>



<pre class="wp-block-code"><code>[program:django-app]
user=apps
directory=/home/apps/django-app/djangoapp/
command=/usr/local/bin/pipenv run gunicorn --workers=3 djangoapp.wsgi

autostart=true
autorestart=true
stdout_logfile=/home/apps/logs/django-app.log
stderr_logfile=/home/apps/logs/django-app.err.log</code></pre>



<ol class="wp-block-list" start="8">
<li>Create the required files and folder:</li>
</ol>



<pre class="wp-block-code"><code>mkdir /home/apps/logs/
touch /home/apps/django-app{,.err}.log</code></pre>



<ol class="wp-block-list" start="9">
<li>Restart supervisor to recognize the app</li>
</ol>



<pre class="wp-block-code"><code>sudo systemctl restart supervisor</code></pre>



<ol class="wp-block-list" start="10">
<li>Create nginx server block file for the app under <code>/etc/nginx/sites-available/django-app.conf</code></li>
</ol>



<pre class="wp-block-code"><code>server {
    listen 80;
    
    location / {
        include proxy_params;
        proxy_pass http://localhost:8000;
    }
}</code></pre>



<ol class="wp-block-list" start="11">
<li>Activate the config and reload nginx</li>
</ol>



<pre class="wp-block-code"><code>sudo ln -s <span style="background-color: inherit; font-family: monospace; font-size: inherit;">/etc/nginx/sites-available/django-app.conf</span> /etc/nginx/sites-enabled
sudo unlink /etc/nginx/sites-enabled/default
sudo nginx -t
sudo nginx -s reload</code></pre>



<ol class="wp-block-list" start="12">
<li>Access the app from your browser: <code>http://your-ip</code> or <code>http://your-domain.tld</code> and DONE!</li>
</ol>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Step-by-step Guide</h2>



<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Django App Peparation</h3>



<p class="wp-block-paragraph">I will assume that your Django App is ready to be deployed. This means it has Pipfile or requirements.txt. For this tutorial, I&#8217;m going to use <code>pipenv</code> as the virtual environment tool and here&#8217;s the directory structure of the app:</p>



<pre class="wp-block-code"><code>├── djangoapp
│   ├── db.sqlite3
│   ├── djangoapp
│   │   ├── asgi.py
│   │   ├── __init__.py
│   │   ├── settings.py
│   │   ├── urls.py
│   │   └── wsgi.py
│   └── manage.py
├── Pipfile
└── Pipfile.lock</code></pre>



<p class="wp-block-paragraph">Make sure the app runs successfully in our local environment by running the below command on the app directory:</p>



<pre class="wp-block-code"><code>pipenv run djangoapp/manage.py runserver</code></pre>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img fetchpriority="high" decoding="async" class="wp-image-2147" src="https://serverstadium.com/wp-content/uploads/2022/06/carbon-1.png" alt="" width="768" height="380" srcset="https://serverstadium.com/wp-content/uploads/2022/06/carbon-1.png 1024w, https://serverstadium.com/wp-content/uploads/2022/06/carbon-1-300x149.png 300w, https://serverstadium.com/wp-content/uploads/2022/06/carbon-1-768x380.png 768w" sizes="(max-width: 768px) 100vw, 768px" /></figure>
</div>


<p class="wp-block-paragraph">Then access your browser with <code>http://127.0.0.1:8000</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img decoding="async" class="wp-image-2148" src="https://serverstadium.com/wp-content/uploads/2022/06/image-1.png" alt="" width="886" height="645" /></figure>
</div>


<p class="wp-block-paragraph">Add your server IP and/or domain to ALLOWED_HOST entry in the <code>settings.py</code> file, then save it.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="289" height="103" class="wp-image-2158" src="https://serverstadium.com/wp-content/uploads/2022/06/image-6.png" alt="" />
<figcaption>Allowed hosts configuration</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">Good, now we are ready to do the deployment.</p>



<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Server Preparation</h3>



<p class="wp-block-paragraph">We will need a specific user that we will use to serve the app, and it should be a non administrative user. To simplify, we will create <strong>apps</strong> user</p>



<pre class="wp-block-code"><code>sudo useradd --create-home --shell /bin/bash apps</code></pre>



<p class="wp-block-paragraph">We will also want to install supervisor and nginx from now</p>



<pre class="wp-block-code"><code>sudo apt update &amp;&amp; sudo apt install supervisor nginx</code></pre>



<p class="wp-block-paragraph">As mentioned earlier, we will be using Python 3.8, which isn&#8217;t available by default, so please take a look at this article on <a href="#" target="_blank" rel="noreferrer noopener">how to install Python 3.8 on Ubuntu 22.04 Jammy</a>. Don&#8217;t forget to install pip as well.</p>



<p class="wp-block-paragraph">Then install <code>pipenv</code> globally:</p>



<pre class="wp-block-code"><code>sudo pip install pipenv</code></pre>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" class="wp-image-2151" src="https://serverstadium.com/wp-content/uploads/2022/06/image-2.png" alt="" width="776" height="435" srcset="https://serverstadium.com/wp-content/uploads/2022/06/image-2.png 1034w, https://serverstadium.com/wp-content/uploads/2022/06/image-2-300x168.png 300w, https://serverstadium.com/wp-content/uploads/2022/06/image-2-1024x574.png 1024w, https://serverstadium.com/wp-content/uploads/2022/06/image-2-768x431.png 768w" sizes="(max-width: 776px) 100vw, 776px" />
<figcaption>Installing pipenv</figcaption>
</figure>
</div>


<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Copy App Files</h3>



<p class="wp-block-paragraph">Copy or clone (using git if it&#8217;s supported) the app files to <code>/home/apps/django-app</code>. You can use FTP, SFTP, SCP or any other means of transferring local files to the remote server. On the remote server, the apps directory should look like follows:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="705" height="531" class="wp-image-2150" src="https://serverstadium.com/wp-content/uploads/2022/06/carbon-2.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/06/carbon-2.png 705w, https://serverstadium.com/wp-content/uploads/2022/06/carbon-2-300x226.png 300w" sizes="(max-width: 705px) 100vw, 705px" />
<figcaption>django-app folder structure</figcaption>
</figure>
</div>


<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Install Required Dependencies</h3>



<p class="wp-block-paragraph">A good thing about <code>pipenv</code> is that it will automatically create a virtual environment upon installing any required dependencies listed in the Pipfile. So, on the django-app folder run:</p>



<pre class="wp-block-code"><code># make sure it's on /home/apps/django-app
python3.8 -m pipenv install --deploy</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1131" height="258" class="wp-image-2152" src="https://serverstadium.com/wp-content/uploads/2022/06/image-3.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/06/image-3.png 1131w, https://serverstadium.com/wp-content/uploads/2022/06/image-3-300x68.png 300w, https://serverstadium.com/wp-content/uploads/2022/06/image-3-1024x234.png 1024w, https://serverstadium.com/wp-content/uploads/2022/06/image-3-768x175.png 768w" sizes="(max-width: 1131px) 100vw, 1131px" /></figure>



<p class="wp-block-paragraph">Next, we will install gunicorn:</p>



<pre class="wp-block-code"><code>python3.8 -m pipenv install gunicorn</code></pre>



<p class="wp-block-paragraph">Then, we will try to serve the app using gunicorn to test, but make sure you run the gunicorn from the app folder where <code>manage.py</code> resides:</p>



<pre class="wp-block-code"><code>cd djangoapp/
python3.8 -m pipenv run gunicorn djangoapp.wsgi</code></pre>



<p class="wp-block-paragraph">It should return something like this:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="729" height="77" class="wp-image-2155" src="https://serverstadium.com/wp-content/uploads/2022/06/image-4.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/06/image-4.png 729w, https://serverstadium.com/wp-content/uploads/2022/06/image-4-300x32.png 300w" sizes="(max-width: 729px) 100vw, 729px" />
<figcaption>Serving django via gunicorn</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">Awesome. Now we can setup <code>supervisor</code> to handle gunicorn process(es).</p>



<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Install and Configure Supervisor</h3>



<p class="wp-block-paragraph">For <strong>Debian-based</strong> distros, run:</p>



<pre class="wp-block-code"><code>sudo apt install supervisor</code></pre>



<p class="wp-block-paragraph">For <strong>RHEL-based</strong> distros, run:</p>



<pre class="wp-block-code"><code>sudo dnf install supervisor
# or
sudo yum install supervisor</code></pre>



<p class="wp-block-paragraph">Then, we will create a config file for the django app in <code>/etc/supervisor/conf.d/</code> and name it as <code>django-app.conf</code>. Write or just copy the following lines to the file:</p>



<pre class="wp-block-code"><code>[program:django-app]
user=apps
directory=/home/apps/django-app/djangoapp
command=/usr/local/bin/pipenv run gunicorn --workers=3 djangoapp.wsgi

autostart=true
autorestart=true
stdout_logfile=/home/apps/logs/django-app.log
stderr_logfile=/home/apps/logs/django-app.err.log</code></pre>



<p class="wp-block-paragraph">Don&#8217;t forget to create the <code>./logs/</code> folder to store the app&#8217;s logs:</p>



<pre class="wp-block-code"><code># as the apps user
mkdir /home/apps/logs</code></pre>



<p class="wp-block-paragraph">Then restart supervisor:</p>



<pre class="wp-block-code"><code>sudo systemctl restart supervisor</code></pre>



<p class="wp-block-paragraph">Make sure it&#8217;s running by checking supervisor status:</p>



<pre class="wp-block-code"><code>sudo systemctl status supervisor</code></pre>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" class="wp-image-2156" src="https://serverstadium.com/wp-content/uploads/2022/06/image-5.png" alt="" width="792" height="311" srcset="https://serverstadium.com/wp-content/uploads/2022/06/image-5.png 1056w, https://serverstadium.com/wp-content/uploads/2022/06/image-5-300x118.png 300w, https://serverstadium.com/wp-content/uploads/2022/06/image-5-1024x401.png 1024w, https://serverstadium.com/wp-content/uploads/2022/06/image-5-768x301.png 768w" sizes="(max-width: 792px) 100vw, 792px" />
<figcaption>Supervisor status</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">Next, we will install and configure Nginx so it proxies the connection.</p>



<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Install and Configure NGINX</h3>



<p class="wp-block-paragraph">Here, nginx will proxy HTTP connections to the gunicorn workers. This will also make SSL setup easier, but I won&#8217;t explain it here. Install nginx and make sure it&#8217;s started on boot:</p>



<pre class="wp-block-code"><code>sudo apt install nginx
sudo systemctl enable nginx --now</code></pre>



<p class="wp-block-paragraph">Then create a new config file in <code>/etc/nginx/sites-available</code> for Ubuntu-based distros, RHEL-based ones should be in <code>/etc/nginx/conf.d</code></p>



<pre class="wp-block-code"><code>server {
    listen 80;
    
    location / {
        include proxy_params;
        proxy_pass http://localhost:8000;
    }
}</code></pre>



<p class="wp-block-paragraph">Save it as <code>django-app.conf</code>. Then for Ubuntu-based distro only, create a symlink in <code>/etc/nginx/sites-enabled/</code> for the config file:</p>



<pre class="wp-block-code"><code>sudo ln -s /etc/nginx/sites-available/django-app.conf /etc/nginx/sites-enabled/django-app.conf</code></pre>



<p class="wp-block-paragraph">Remove the default site config</p>



<pre class="wp-block-code"><code>sudo unlink /etc/nginx/sites-enabled/default</code></pre>



<p class="wp-block-paragraph">For RHEL-based distros, one might need to remove the default config or rename the extension to <code>.bak</code> or something else. Then, test nginx and reload it</p>



<pre class="wp-block-code"><code>sudo nginx -t
sudo nginx -s reload</code></pre>



<h3 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Access Test</h3>



<p class="wp-block-paragraph">Finally, test it from your browser via <code>http://YOUR-IP</code> or <code>http://YOUR-DOMAIN.TLD</code></p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1040" height="541" class="wp-image-2159" src="https://serverstadium.com/wp-content/uploads/2022/06/image-7.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2022/06/image-7.png 1040w, https://serverstadium.com/wp-content/uploads/2022/06/image-7-300x156.png 300w, https://serverstadium.com/wp-content/uploads/2022/06/image-7-1024x533.png 1024w, https://serverstadium.com/wp-content/uploads/2022/06/image-7-768x400.png 768w" sizes="(max-width: 1040px) 100vw, 1040px" /></figure>



<p class="wp-block-paragraph">Yay! You&#8217;re now able to deploy your Django app!</p>



<p class="wp-block-paragraph"><strong>IMPORTANT NOTE:</strong> This is a basic setup that is insecure. For a complete documentation on how to configure your Django so it fits production deployment, please refer to <a href="https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/" target="_blank" rel="noreferrer noopener nofollow">this official documentation</a></p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Conclusion</h2>



<p class="wp-block-paragraph">We just learned how to deploy a django application using Pipenv as the virtual environment tool, Gunicorn as the Web Server Gateway, Supervisor as the process manager, and NGINX as the reverse proxy.</p>



<p class="wp-block-paragraph">Find more tutorial articles in ServerStadium&#8217;s <a href="https://serverstadium.com/knowledge-base/" target="_blank" rel="noreferrer noopener">Knowledge Base</a>,  <a href="https://cp.serverstadium.com/regist-user" target="_blank" rel="noreferrer noopener"> Register now</a> for free in ServerStadium&#8217;s panel to try our cloud VMs.</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/how-to-deploy-django-app-on-serverstadium-vm-using-gunicorn-supervisor-and-nginx/">How to Deploy Django App on ServerStadium VM Using Gunicorn, Supervisor, and Nginx</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Reverse Proxy management using Nginx Proxy Manager</title>
		<link>https://serverstadium.com/knowledge-base/reverse-proxy-management-using-nginx-proxy-manager/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Mon, 27 Dec 2021 07:24:00 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=1719</guid>

					<description><![CDATA[<p>Managing proxy hosts can be tedious sometimes. Thanks to its user-friendly web interface, Nginx Proxy Manager allows you to manage your proxy hosts easily and swiftly. However, NPM (Nginx Proxy Manager) currently does not support Load Balancing configuration. But, for basic proxying use cases, this is more than enough! So, let&#8217;s jump on to it,&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/reverse-proxy-management-using-nginx-proxy-manager/">Reverse Proxy management using Nginx Proxy Manager</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Managing proxy hosts can be tedious sometimes. Thanks to its user-friendly web interface, Nginx Proxy Manager allows you to manage your proxy hosts easily and swiftly.</p>



<p class="wp-block-paragraph">However, NPM (Nginx Proxy Manager) currently does not support Load Balancing configuration. But, for basic proxying use cases, this is more than enough! So, let&#8217;s jump on to it, shall we?</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">TLDR Guide</h2>



<ol class="wp-block-list">
<li>Install <code>docker-ce</code> and <code>docker-compose</code></li>
<li>Create new folder <code>npm</code> or <code>nginxproxymanager</code> or anything else.</li>
<li>Save these lines as <code>docker-compose.yaml</code> in the folder</li>
</ol>



<pre class="wp-block-code"><code>version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt</code></pre>



<ol class="wp-block-list" start="4">
<li>Run the stack</li>
</ol>



<pre class="wp-block-code"><code>docker-compose up -d</code></pre>



<ol class="wp-block-list" start="5">
<li>Access the admin UI via <code>http://YOUR-IP:81</code> . Remember, it&#8217;s PORT 81.</li>
<li>Default credentials</li>
</ol>



<pre class="wp-block-code"><code>Email:    admin@example.com
Password: changeme</code></pre>



<ol class="wp-block-list" start="7">
<li>Change the default login.</li>
<li>Enjoy!</li>
</ol>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Prerequisites</h2>



<ol class="wp-block-list">
<li>Port 80, 81, and 443 are allowed on Firewall and Security Profile.</li>
<li>A domain name, at least.</li>
</ol>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Installation Steps</h2>



<p class="wp-block-paragraph">This installation guide would be OS-agnostic as this will run on any system with docker installed.</p>



<p class="wp-block-paragraph">Assuming that <code>docker-ce</code> and <code>docker-compose</code> has been installed on your server. (Otherwise, check out <a href="https://serverstadium.com/knowledge-base/how-to-deploy-portainer/">this article</a> and see only the docker installation part)</p>



<p class="wp-block-paragraph">First, create a docker network with any name you wish:</p>



<pre class="wp-block-code"><code>docker network create proxy_network</code></pre>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="719" height="91" class="wp-image-1721" src="https://serverstadium.com/wp-content/uploads/2021/12/image.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image.png 719w, https://serverstadium.com/wp-content/uploads/2021/12/image-300x38.png 300w" sizes="(max-width: 719px) 100vw, 719px" />
<figcaption>Create docker network</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">Create a folder wherever you like and give it a name:</p>



<pre class="wp-block-code"><code>mkdir /opt/nginx_proxy
cd /opt/nginx_proxy</code></pre>



<p class="wp-block-paragraph">Then, save the following configuration as <code>docker-compose.yaml</code> :</p>



<pre class="wp-block-code"><code>version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

networks:
  default:
    external:
      name: proxy_network</code></pre>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" class="wp-image-1722" src="https://serverstadium.com/wp-content/uploads/2021/12/image-1.png" alt="" />
<figcaption>Stack configuration</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">It&#8217;s a very basic configuration that will use SQLite as the database. So, if you wish to use MySQL/MariaDB instead, please use the following, and change the appropriate values:</p>



<pre class="wp-block-code"><code>version: "3"
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      # These ports are in format &lt;host-port&gt;:&lt;container-port&gt;
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      # Add any other Stream port you want to expose
      # - '21:21' # FTP
    environment:
      DB_MYSQL_HOST: "db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "npm"
      DB_MYSQL_PASSWORD: "npm"
      DB_MYSQL_NAME: "npm"
      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - db

  db:
    image: 'jc21/mariadb-aria:latest'
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: 'npm'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'npm'
      MYSQL_PASSWORD: 'npm'
    volumes:
      - ./data/mysql:/var/lib/mysql</code></pre>



<p class="wp-block-paragraph">Then, bring up the stack:</p>



<pre class="wp-block-code"><code>docker-compose up -d</code></pre>



<p class="wp-block-paragraph">Lastly, wait until the process is done.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" class="wp-image-1724" src="https://serverstadium.com/wp-content/uploads/2021/12/image-3.png" alt="" />
<figcaption>NPM is up and running</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">Your NPM (Nginx Proxy Manager) should be accessible via <code>http://YOUR_IP:81</code></p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" class="wp-image-1725" src="https://serverstadium.com/wp-content/uploads/2021/12/image-4.png" alt="" width="623" height="430" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-4.png 830w, https://serverstadium.com/wp-content/uploads/2021/12/image-4-300x207.png 300w, https://serverstadium.com/wp-content/uploads/2021/12/image-4-768x530.png 768w" sizes="(max-width: 623px) 100vw, 623px" />
<figcaption>NPM login page</figcaption>
</figure>
</div>


<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Initial Setup</h2>



<p class="wp-block-paragraph">On the login page, enter the default NPM credentials as follows:</p>



<pre class="wp-block-code"><code>Email:    admin@example.com
Password: changeme</code></pre>



<p class="wp-block-paragraph">After successfully logging in, a dialog box will show up, and it will let you change the default credentials.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" class="wp-image-1726" src="https://serverstadium.com/wp-content/uploads/2021/12/image-5.png" alt="" />
<figcaption>Change email address</figcaption>
</figure>
</div>

<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="493" height="403" class="wp-image-1727" src="https://serverstadium.com/wp-content/uploads/2021/12/image-6.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-6.png 493w, https://serverstadium.com/wp-content/uploads/2021/12/image-6-300x245.png 300w" sizes="(max-width: 493px) 100vw, 493px" />
<figcaption>Change default password</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">Now, NPM is ready! Yay~</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" class="wp-image-1728" src="https://serverstadium.com/wp-content/uploads/2021/12/image-7.png" alt="" width="541" height="371" />
<figcaption>Nginx Proxy Manager dashboard</figcaption>
</figure>
</div>


<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Adding your first proxy host</h2>



<p class="wp-block-paragraph">NPM offers four types of proxy passes. Basic proxy pass called Proxy Hosts, redirection hosts, proxy streaming, and 404 hosts. This article will only cover the Proxy Hosts section, and I leave it to you to discover the rest 😉</p>



<p class="wp-block-paragraph">For your very first proxy host configuration, why don&#8217;t you proxy the NPM dashboard? Accessing it directly via IP: port is ugly! Now, let&#8217;s create it!</p>



<p class="wp-block-paragraph">First, ensure you already create an A record for your domain/subdomain that points to this server via your DNS manager. How to do it depends on your registrar/domain name provider.</p>



<p class="wp-block-paragraph">On the dashboard, click on the Proxy Hosts button. It should show something like this:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="683" height="307" class="wp-image-1729" src="https://serverstadium.com/wp-content/uploads/2021/12/image-8.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-8.png 683w, https://serverstadium.com/wp-content/uploads/2021/12/image-8-300x135.png 300w" sizes="(max-width: 683px) 100vw, 683px" />
<figcaption>Add new proxy host</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">Click Add Proxy Host. And then, fill in the required fields as follows:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" class="wp-image-1730" src="https://serverstadium.com/wp-content/uploads/2021/12/image-9.png" alt="" /></figure>
</div>


<p class="wp-block-paragraph">The proxy host is on the same machine, so I prefer to put its private IP. Putting the public IP will work too. Make sure the forwarded port is 81. You can also cache assets, enable WebSockets support, and block common exploits. Here, I will enable the Block Common Exploits.</p>



<p class="wp-block-paragraph">Move to the SSL tab; unless you&#8217;re using Cloudflare SSL (automatically provided by default), you can use LetsEncrypt to generate a valid SSL certificate. And do not forget to enable the options you want.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>If you&#8217;re using Cloudflare, do not enable Force SSL option as it will result in redirection loop.</p>
</blockquote>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="477" height="532" class="wp-image-1731" src="https://serverstadium.com/wp-content/uploads/2021/12/image-10.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-10.png 477w, https://serverstadium.com/wp-content/uploads/2021/12/image-10-269x300.png 269w" sizes="(max-width: 477px) 100vw, 477px" /></figure>
</div>


<p class="wp-block-paragraph">Finally, click Save. Your Proxy Hosts page should now list your very first proxy host.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" class="wp-image-1732" src="https://serverstadium.com/wp-content/uploads/2021/12/image-11.png" alt="" width="679" height="134" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-11.png 905w, https://serverstadium.com/wp-content/uploads/2021/12/image-11-300x59.png 300w, https://serverstadium.com/wp-content/uploads/2021/12/image-11-768x152.png 768w" sizes="(max-width: 679px) 100vw, 679px" /></figure>
</div>


<p class="wp-block-paragraph">Now, the moment of truth. Try to access the URL:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" class="wp-image-1733" src="https://serverstadium.com/wp-content/uploads/2021/12/image-12.png" alt="" width="654" height="430" srcset="https://serverstadium.com/wp-content/uploads/2021/12/image-12.png 872w, https://serverstadium.com/wp-content/uploads/2021/12/image-12-300x197.png 300w, https://serverstadium.com/wp-content/uploads/2021/12/image-12-768x505.png 768w" sizes="(max-width: 654px) 100vw, 654px" />
<figcaption>It works!</figcaption>
</figure>
</div>


<p class="wp-block-paragraph">Hooray, it is working.</p>



<h2 class="wp-block-heading">Conclusion</h2>



<p class="wp-block-paragraph">That&#8217;s way too easy, right? Now, you can deploy your own Nginx Proxy Manager using docker-compose and manage your proxy hosts using a simple user interface.</p>



<p class="wp-block-paragraph">For more IT knowledge, you can access it freely in ServerStadium&#8217;s knowledge<a href="https://serverstadium.com/knowledge-base/" target="_blank" rel="noreferrer noopener"> base. </a>Or, for real exciting experience, you can also <a href="https://cp.serverstadium.com/regist-user" target="_blank" rel="noreferrer noopener">sign up</a> in ServerStadium and find out what you can do in our dashboard.</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/reverse-proxy-management-using-nginx-proxy-manager/">Reverse Proxy management using Nginx Proxy Manager</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>High Availability Kubernetes Using RKE in ServerStadium Part 1</title>
		<link>https://serverstadium.com/knowledge-base/high-availability-kubernetes-using-rke-in-serverstadium-part-1/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Wed, 27 Oct 2021 07:22:51 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=1387</guid>

					<description><![CDATA[<p>Kubernetes is an Opensource platform that manages workloads or containerized applications on servers.Google first developed this platform. Now it’s managed by the Cloud Native Computing Foundation (CNCF). In short, Its function is to make us easy to configure, deploy, manage, or monitor the largest scale of a containerized application in different deployment environments. Before we&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/high-availability-kubernetes-using-rke-in-serverstadium-part-1/">High Availability Kubernetes Using RKE in ServerStadium Part 1</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Kubernetes is an Opensource platform that manages workloads or containerized applications on servers.<br />Google first developed this platform. Now it’s managed by the Cloud Native Computing Foundation (CNCF).</p>



<p class="wp-block-paragraph">In short, Its function is to make us easy to configure, deploy, manage, or monitor the largest scale of a containerized application in different deployment environments.</p>



<p class="wp-block-paragraph">Before we talk about containers, let&#8217;s talk about Docker because Docker is a popular application that is often used with Kubernetes.</p>



<p class="wp-block-paragraph">Docker is an open-source application that only uses the required program and elements that a program needs to be a complete unit as an image.  We can use that image to run an application like Nginx, WordPress, etc.<br />The collection of these images we will call a Container.</p>



<p class="wp-block-paragraph">The container will run on a pod, where the pod is the smallest deployable unit in Kubernetes.<br />Installing Kubernetes is tricky because there are multiple ways to install it. Also, Kubernetes deployments container creation is not limited to using docker. We can use another container runtime like CoreOS, Mesos, LXC, Podman, etc.<br /><br />In RKE1 (Rancher Kubernetes Engine), we will use Docker as the container runtime to deploy Kubernetes with simple installation.</p>



<p class="wp-block-paragraph">RKE1 is a CNCF-certified Kubernetes distribution that runs within Docker Container, and it will make us easier to install Kubernetes in our infrastructure with a single YAML file.<br /><br />After Kubernetes has been installed, we will install Rancher to manage it.<br />Rancher has a nice web UI that we can use to add, manage, monitor, remove the nodes, create a deployment, create the persistent volume of Kubernetes, and many things.</p>



<p class="wp-block-paragraph">In Part 1, we will deploy Kubernetes in ServerStadium Cloud as follow:</p>



<ul class="wp-block-list">
<li>Launch at least 3 VM on the ServerStadium Cloud for High Availability workload.</li>
<li>Enable SSH passwordless login for each Kubernetes node.</li>
<li>Install docker on each node.</li>
<li>Download RKE binary file and configure the Kubernetes.</li>
</ul>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading"><strong>Launch at Least 3 VM on ServerStadium Cloud for High Availability Workload</strong></h2>



<p class="wp-block-paragraph">For High Availability Kubernetes, we need three VMs as Kubernetes nodes in ServerStadium Cloud. Below is the specification for every node:</p>



<p class="wp-block-paragraph">Operating System: Ubuntu 20.04<br />Memory: 4GB<br />CPU: 2 Core<br />Disk: 20 GB<br />Public IP Address only for node1 because we will install RKE from node1. <br />For node2 and node3, we only need the Private IP Address.</p>



<p class="wp-block-paragraph">Below is the IP Address of every node:<br /><strong>node1 :</strong><br />Public IP Address: 198.167.141.249<br />Private IP Address: 10.1.1.205</p>



<p class="wp-block-paragraph"><strong>node2:</strong><br />Private IP Address: 10.1.1.47</p>



<p class="wp-block-paragraph"><strong>node3 : </strong><br />Private IP Address: 10.1.1.238</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading"><strong>Enable SSH Passwordless Login for Each Kubernetes Node</strong></h2>



<p class="wp-block-paragraph">Before deploying RKE on the server, we must enable SSH passwordless for easy installation with a custom domain internal. Instead of remembering the IP Address, it&#8217;s easy to remember the node using its names.</p>



<pre class="wp-block-code"><code># vim /etc/hosts</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" class="wp-image-1389" src="https://serverstadium.com/wp-content/uploads/2021/09/image.png" alt="" /></figure>



<p class="wp-block-paragraph">Let’s generate the ssh key pair using the following command.</p>



<pre class="wp-block-preformatted"># ssh-keygen</pre>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" class="wp-image-1390" src="https://serverstadium.com/wp-content/uploads/2021/09/image-1.png" alt="" width="396" height="227" /></figure>



<p class="wp-block-paragraph">After generating the ssh keypair is completed, we can upload the Public key to each node using command ssh-copy-id<br />Please run the following command from node1.</p>



<pre class="wp-block-code"><code># ssh-copy-id node3
# ssh-copy-id node2
# ssh-copy-id node1</code></pre>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" class="wp-image-1391" src="https://serverstadium.com/wp-content/uploads/2021/09/image-2.png" alt="" width="666" height="151" /></figure>



<p class="wp-block-paragraph"><strong>Install docker on each node</strong>:<strong><br /></strong>Since we need docker for Kubernetes, we will install it on every node using the following command:</p>



<p class="wp-block-paragraph">Firstly, we need to update our repository and allow our server to access the Docker repository using HTTPS</p>



<pre class="wp-block-preformatted">sudo apt-get update &amp;&amp; sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y</pre>



<p class="wp-block-paragraph">Add a GPG key to ensure the authenticity of the software package</p>



<pre class="wp-block-preformatted"># curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -</pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="790" height="33" class="wp-image-1567" src="https://serverstadium.com/wp-content/uploads/2021/10/image.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/10/image.png 790w, https://serverstadium.com/wp-content/uploads/2021/10/image-300x13.png 300w, https://serverstadium.com/wp-content/uploads/2021/10/image-768x32.png 768w" sizes="(max-width: 790px) 100vw, 790px" /></figure>



<p class="wp-block-paragraph">Now, we can add Docker repository to our server and then install the stable Docker version using the following command :</p>



<pre id="block-0b46ee22-d40b-468e-90a2-cd60d24891a7" class="wp-block-preformatted"># sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" 

# sudo apt-get update &amp;&amp; sudo apt-get install docker-ce containerd.io -y</pre>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading"><strong>Download RKE Binary File and Configure the Kubernetes</strong></h2>



<p class="wp-block-paragraph">Before we deploy Kubernetes on the server, we need to download rke binary from the following link.<br />Download latest rke from <a href="https://github.com/rancher/rke/releases/">https://github.com/rancher/rke/releases/</a></p>



<pre class="wp-block-code"><code># wget https://github.com/rancher/rke/releases/download/v1.2.12/rke_linux-amd64</code></pre>



<p class="wp-block-paragraph">Rename the file as rke</p>



<pre class="wp-block-code"><code> # mv rke_linux-amd64 rke</code></pre>



<p class="wp-block-paragraph">Then, make rke as executable file</p>



<pre class="wp-block-code"><code># chmod +x rke</code></pre>



<p class="wp-block-paragraph">In ServerStadium Cloud, we will create a simple cluster from three nodes using the following yml.</p>



<p class="wp-block-paragraph">Create a simple cluster.yml</p>



<pre class="wp-block-code"><code>nodes:
    - address: node1
      user: root
      internal_address: 10.1.1.205
      role: [controlplane, etcd, worker]
    - address: node2
      user: root
      internal_address: 10.1.1.47
      role: [controlplane, etcd, worker]
    - address: node3
      user: root
      internal_address: 10.1.1.238
      role: [controlplane, etcd, worker]
services:
  etcd:
    snapshot: true
    creation: 6h
    retention: 24h
# Required for external TLS termination with
# ingress-nginx v0.22+
ingress:
  provider: nginx
  options:
    use-forwarded-headers: "true"

</code></pre>



<p class="wp-block-paragraph">Save the file, then we can continue to deploy Kubernetes using the command rke up. The installation will take around 10-15 minutes.</p>



<pre class="wp-block-code"><code># ./rke up</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" class="wp-image-1394" src="https://serverstadium.com/wp-content/uploads/2021/09/image-3.png" alt="" /></figure>



<figure class="wp-block-image size-large"><img decoding="async" class="wp-image-1395" src="https://serverstadium.com/wp-content/uploads/2021/09/image-4.png" alt="" /></figure>



<p class="wp-block-paragraph">After the installation is completed. It will create three files, and please save them in a secure location:<br /><strong>rancher-cluster.yml</strong>: The RKE cluster configuration file that we have created previously.<br />kube_config_rancher-cluster.yml: The Kubeconfig file for the cluster.<br /><strong>rancher-cluster.rkestate</strong>: The Kubernetes Cluster State file</p>



<p class="wp-block-paragraph">If you want to know the status of the cluster node, we can use the kubectl command. <br />kubectl is a command-line tool that we can use to send a command to the Kubernetes cluster. <br />kubectl is authenticating with the Master node and making API calls to perform various management actions.<br />Copy the kube_config_rancher-cluster.yml as a config file. You can follow the following steps:</p>



<pre class="wp-block-code"><code># mkdir /root/.kube
# cp kube_config_cluster.yml /root/.kube/config</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" class="wp-image-1396" src="https://serverstadium.com/wp-content/uploads/2021/09/image-5.png" alt="" /></figure>



<p class="wp-block-paragraph">Now, install kubectl on the master node</p>



<pre class="wp-block-preformatted"># snap install kubectl --classic</pre>



<figure class="wp-block-image size-large"><img decoding="async" class="wp-image-1570" src="https://serverstadium.com/wp-content/uploads/2021/10/image-1.png" alt="" /></figure>



<p class="wp-block-paragraph">Run kubectl command to get the status of the nodes</p>



<pre class="wp-block-code"><code>#kubectl get nodes</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" class="wp-image-1398" src="https://serverstadium.com/wp-content/uploads/2021/09/image-7.png" alt="" /></figure>



<pre class="wp-block-code"><code>#kubectl get namespace</code></pre>



<figure class="wp-block-image size-large"><img decoding="async" class="wp-image-1399" src="https://serverstadium.com/wp-content/uploads/2021/09/image-8.png" alt="" /></figure>



<p class="wp-block-paragraph">Now it has been deployed. Next step, we will install Rancher to manage our Kubernetes Server.<br />Let&#8217;s go to continue to <strong><a href="https://serverstadium.com/knowledge-base/high-availability-kubernetes-using-rke-in-serverstadium-part-2/" target="_blank" rel="noreferrer noopener">the next part</a></strong></p>



<p class="wp-block-paragraph">&nbsp;</p>



<p class="wp-block-paragraph">&nbsp;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/high-availability-kubernetes-using-rke-in-serverstadium-part-1/">High Availability Kubernetes Using RKE in ServerStadium Part 1</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Setup Your Own Laravel with Nginx in Ubuntu 18.04</title>
		<link>https://serverstadium.com/knowledge-base/how-to-setup-your-own-laravel-with-nginx-in-ubuntu-18-04/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Thu, 07 Jan 2021 07:01:21 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=685</guid>

					<description><![CDATA[<p>This tutorial will help you setup Laravel with Nginx in Ubuntu. In this tutorial, we will use Ubuntu 18 server to deploy Laravel. Laravel is a web application framework written in PHP language. To setup Laravel in your Ubuntu Server with Nginx, we need to install the following requirements below: The web server The database PHP&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/how-to-setup-your-own-laravel-with-nginx-in-ubuntu-18-04/">How to Setup Your Own Laravel with Nginx in Ubuntu 18.04</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">This tutorial will help you setup Laravel with <a href="https://serverstadium.com/knowledge-base/installing-lemp-stack-on-ubuntu-1804/">Nginx</a> in <a href="https://serverstadium.com/knowledge-base/installing-lamp-in-ubuntu/">Ubuntu</a>. In this tutorial, we will use Ubuntu 18 server to deploy Laravel. Laravel is a web application framework written in PHP language.</p>



<p class="wp-block-paragraph">To setup Laravel in your Ubuntu Server with Nginx, we need to install the following requirements below:</p>



<ul class="wp-block-list">
<li>The web server</li>
<li>The database</li>
<li>PHP 7.2</li>
<li>Composer</li>
<li>Laravel</li>
</ul>



<p class="wp-block-paragraph">In this case, we use Nginx as the web server software and Mariadb as the database software. Also, we only have to open the default port on ServerStadium Default Security Profile which is only open port 22, 80 and 443.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="803" height="387" class="wp-image-687" src="https://serverstadium.com/wp-content/uploads/2021/01/fw-img.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/fw-img.png 803w, https://serverstadium.com/wp-content/uploads/2021/01/fw-img-300x145.png 300w, https://serverstadium.com/wp-content/uploads/2021/01/fw-img-768x370.png 768w" sizes="(max-width: 803px) 100vw, 803px" /></figure>



<p class="wp-block-paragraph">Without further ado, here are the steps to setup Laravel with Nginx in Ubuntu 18.04.</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Step 1 – Install Nginx</h2>



<p class="wp-block-paragraph">Firstly, you can run “sudo apt-get update” to download package information from all configured sources.</p>



<p class="wp-block-paragraph">Then to install nginx you can run the following command below:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>apt-get install nginx</p>
</blockquote>



<p class="wp-block-paragraph">After the installation process is complete, you can check nginx status by run:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>systemctl status nginx</p>
</blockquote>



<p class="wp-block-paragraph">And the output should be like this if nginx is active.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="994" height="257" class="wp-image-688" src="https://serverstadium.com/wp-content/uploads/2021/01/nginx-status-img.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/nginx-status-img.png 994w, https://serverstadium.com/wp-content/uploads/2021/01/nginx-status-img-300x78.png 300w, https://serverstadium.com/wp-content/uploads/2021/01/nginx-status-img-768x199.png 768w" sizes="(max-width: 994px) 100vw, 994px" /></figure>



<p class="wp-block-paragraph">Or you can check it by opening your server IP public on your browser, and the page will display Apache2 Ubuntu Default Page as below.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1422" height="812" class="wp-image-690" src="https://serverstadium.com/wp-content/uploads/2021/01/pict03.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/pict03.png 1422w, https://serverstadium.com/wp-content/uploads/2021/01/pict03-300x171.png 300w, https://serverstadium.com/wp-content/uploads/2021/01/pict03-1024x585.png 1024w, https://serverstadium.com/wp-content/uploads/2021/01/pict03-768x439.png 768w" sizes="(max-width: 1422px) 100vw, 1422px" /></figure>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Step 2 – Install MariaDB</h2>



<p class="wp-block-paragraph">The second step is to install the database or MariaDB. To install it, you can use the following command:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>apt install mariadb-server</p>
</blockquote>



<p class="wp-block-paragraph">Since we use the default source, At the time of writing, the version of MariaDB is 10.1.47. To check mariadb status, you can run this command:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>systemctl status mariadb.service</p>
</blockquote>



<p class="wp-block-paragraph">The output will be like this if the service is running.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1033" height="336" class="wp-image-691" src="https://serverstadium.com/wp-content/uploads/2021/01/pict04.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/pict04.png 1033w, https://serverstadium.com/wp-content/uploads/2021/01/pict04-300x98.png 300w, https://serverstadium.com/wp-content/uploads/2021/01/pict04-1024x333.png 1024w, https://serverstadium.com/wp-content/uploads/2021/01/pict04-768x250.png 768w" sizes="(max-width: 1033px) 100vw, 1033px" /></figure>



<p class="wp-block-paragraph">With the following command above, the database is already installed, and you can login to the mysql without any password using root user. But if you want to setup the user for the mysql you can run the following command below and setup the password for root user.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>mysql_secure_installation</p>
</blockquote>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Step 3 – Install PHP 7.2</h2>



<p class="wp-block-paragraph">PHP 7.2 is included in the default Ubuntu repository for 18.04. We can list each of the available PHP 7.2 packages with the following command:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>apt-cache pkgnames | grep php7.2</p>
</blockquote>



<p class="wp-block-paragraph">Next, we can install the packages that our application requires by typing:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>apt-get install php curl git unzip</p>
</blockquote>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>apt-get install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php</p>
</blockquote>



<p class="wp-block-paragraph">Finally, we can restart nginx to allow PHP to run:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>systemctl restart nginx</p>
</blockquote>



<p class="wp-block-paragraph">Then, we can confirm the PHP version by type:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>php –version</p>
</blockquote>



<p class="wp-block-paragraph">Here is the output of the checking command version above.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="679" height="79" class="wp-image-692" src="https://serverstadium.com/wp-content/uploads/2021/01/pict05.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/pict05.png 679w, https://serverstadium.com/wp-content/uploads/2021/01/pict05-300x35.png 300w" sizes="(max-width: 679px) 100vw, 679px" /></figure>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Step 4 – Install composser</h2>



<p class="wp-block-paragraph">Since composer is already part of the repository, we can install it using the following command below.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>apt-get install composer</p>
</blockquote>



<p class="wp-block-paragraph">To ensure that the composer is already installed, we can check it by running command “composer” and it will show the manual as below.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1091" height="835" class="wp-image-693" src="https://serverstadium.com/wp-content/uploads/2021/01/pict06.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/pict06.png 1091w, https://serverstadium.com/wp-content/uploads/2021/01/pict06-300x230.png 300w, https://serverstadium.com/wp-content/uploads/2021/01/pict06-1024x784.png 1024w, https://serverstadium.com/wp-content/uploads/2021/01/pict06-768x588.png 768w" sizes="(max-width: 1091px) 100vw, 1091px" /></figure>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Step 5 – Install Laravel using composer</h2>



<p class="wp-block-paragraph">When installing laravel or creating a laravel project, you must enter the directory where you want to save the project data, or you can create the project first and then move the data to the right locale where you want to save it.</p>



<p class="wp-block-paragraph">In this tutorial, I use /var/www/html as my data storage location, and my project name is testlaravel. Then to install laravel you can run this command below.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>composer create-project &#8211;prefer-dist laravel/laravel [projectName]</p>
</blockquote>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="607" height="586" class="wp-image-694" src="https://serverstadium.com/wp-content/uploads/2021/01/pict07.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/pict07.png 607w, https://serverstadium.com/wp-content/uploads/2021/01/pict07-300x290.png 300w" sizes="(max-width: 607px) 100vw, 607px" /></figure>



<p class="wp-block-paragraph">FYI, in the picture above, I give my project name &#8220;laraveltest&#8221; <br /><br />After laravel installation is complete, you can move the project folder to /var/www/html/ then change the owner of the project to www-data with the following command below.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>sudo mv [projectName] /var/www/html/</p>
</blockquote>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>chown -R www-data:www-data /var/www/html/[projectName]/</p>
</blockquote>



<p class="wp-block-paragraph">Now the next step is to config the virtual host so we can access the website through our browser. You can use the following command below to edit the virtual host file.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>nano /etc/nginx/sites-available/vhostlaravel.conf</p>
</blockquote>



<p class="wp-block-paragraph">After the text editor is opened, we can use the simple config below. <br /><br />NB: <br />&#8211; If you have a different project location change the root document location with your project location.</p>



<pre class="wp-block-code"><code>server {
     listen 80;
     listen [::]:80 ipv6only=on;

     # Log files for Debugging
     access_log /var/log/nginx/vhostlaravel-access.log;
     error_log /var/log/nginx/vhostlaravel-error.log;

     # Webroot Directory for Laravel project
     root /var/www/html/laraveltest/public;
     index index.php index.html index.htm;

     # Your Domain Name
     server_name www.your_domain.com your_domain.com;

     location / {
             try_files $uri $uri/ /index.php?$query_string;
     }

     # PHP-FPM Configuration Nginx
     location ~ \.php$ {
             try_files $uri =404;
             fastcgi_split_path_info ^(.+\.php)(/.+)$;
             fastcgi_pass unix:/run/php/php7.2-fpm.sock;
             fastcgi_index index.php;
             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
             include fastcgi_params;
     }
}</code></pre>



<p class="wp-block-paragraph">After we save the config, we need to create links file of the virtual host from /etc/nginx/sites-available to /etc/nginx/sites-enabled by using the following command below.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>ln -s /etc/nginx/sites-available/vhostlaravel.conf /etc/nginx/sites-enabled/</p>
</blockquote>



<p class="wp-block-paragraph">Then we must test the virtual host config using the simple command &#8220;nginx -t&#8221;. Accordingly, if your virtual host config is correct, it will give an output like this:</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="516" height="47" class="wp-image-695" src="https://serverstadium.com/wp-content/uploads/2021/01/pict09.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2021/01/pict09.png 516w, https://serverstadium.com/wp-content/uploads/2021/01/pict09-300x27.png 300w" sizes="(max-width: 516px) 100vw, 516px" /></figure>



<p class="wp-block-paragraph">After the output says that syntax is OK we can restart nginx to apply the virtual host using the following command below.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>systemctl restart nginx</p>
</blockquote>



<p class="wp-block-paragraph">To test our laravel project, we can change our local resolver file.<br />If you are on a Mac or Linux computer at home, you can edit the file needed by typing:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>nano /etc/hosts</p>
</blockquote>



<p class="wp-block-paragraph"><br />If you are using Windows desktop, you can edit file &#8220;hosts&#8221; from the notepad by accessing this folder:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>C:\Windows\System32\drivers\etc</p>
</blockquote>



<p class="wp-block-paragraph">Then assuming that your server’s public IP address is 97.22.10.9 , the lines we need to add to the &#8220;hosts&#8221; file would look something like this:</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>97.22.10.9 www.your_domain.com your_domain.com</p>
</blockquote>



<p class="wp-block-paragraph">Finally, we can test to access our Laravel project through the browser, and the output will look like this.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" class="wp-image-697" src="https://serverstadium.com/wp-content/uploads/2021/01/laravel-home-page-1.png" alt="" width="580" height="310" srcset="https://serverstadium.com/wp-content/uploads/2021/01/laravel-home-page-1.png 1597w, https://serverstadium.com/wp-content/uploads/2021/01/laravel-home-page-1-300x161.png 300w, https://serverstadium.com/wp-content/uploads/2021/01/laravel-home-page-1-1024x548.png 1024w, https://serverstadium.com/wp-content/uploads/2021/01/laravel-home-page-1-768x411.png 768w, https://serverstadium.com/wp-content/uploads/2021/01/laravel-home-page-1-1536x822.png 1536w" sizes="(max-width: 580px) 100vw, 580px" /></figure>



<p class="wp-block-paragraph">&nbsp;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/how-to-setup-your-own-laravel-with-nginx-in-ubuntu-18-04/">How to Setup Your Own Laravel with Nginx in Ubuntu 18.04</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
