tag:blogger.com,1999:blog-65636194425558672192024-02-07T18:18:13.125-08:00Linux CPanel / WHM Datlinux | Webhosting Blog | Linux Cpanel/WHM blog | Linux blogsdatlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.comBlogger281125tag:blogger.com,1999:blog-6563619442555867219.post-31292974655205507462020-05-23T13:03:00.001-07:002020-05-23T13:03:52.658-07:00How to install Ajenti control panel.<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEial-5jec8BuYC_a6UrU3QpB17v0bJ2jn2F__Mjk0UZ50P9oIIi8SeynTJgDv8gcQmA9cHO5FqiU5FIi3OxsXb9XR5qrmaNwqMyzSWvIxH0EIHgSYvlVPnROVmq1xu0dBMqfuLDNPwuKUE3/" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="714" data-original-width="1029" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEial-5jec8BuYC_a6UrU3QpB17v0bJ2jn2F__Mjk0UZ50P9oIIi8SeynTJgDv8gcQmA9cHO5FqiU5FIi3OxsXb9XR5qrmaNwqMyzSWvIxH0EIHgSYvlVPnROVmq1xu0dBMqfuLDNPwuKUE3/s320/1.png" width="320" /></a></div><div><br /></div><div><br /></div><div><a href="http://ajenti.org/" rel="nofollow" target="_blank">Ajenti</a> is a modern, lightweight,
open source, web-based control panel for managing virtual private
servers (VPS). </div><p>Using Ajenti,
an administrator can control a Linux server from a browser with its
responsive web interface, which otherwise requires the use of a
terminal. Optionally, one can extend the functionalities of Ajenti using
few existing plug-ins or develop a custom plugin from scratch using
Python.</p><p>Supported operating systems:</p>
<ul class="simple"><li>Debian 9 or later</li><li>Ubuntu Bionic or later</li><li>CentOS 8 or later</li><li>RHEL 8 or later</li></ul>
<p class="last">Other Linux-based systems <em>might</em> work, but you’ll have to use manual installation method.</p><h2>Automatic Installation</h2><div><pre><span class="n"></span><blockquote><span class="n">curl</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">raw</span><span class="o">.</span><span class="n">githubusercontent</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">ajenti</span><span class="o">/</span><span class="n">ajenti</span><span class="o">/</span><span class="n">master</span><span class="o">/</span><span class="n">scripts</span><span class="o">/</span><span class="n">install</span><span class="o">.</span><span class="n">sh</span> <span class="o">|</span> <span class="n">sudo</span> <span class="n">bash</span> <span class="o">-</span><span class="n">s</span> <span class="o">-</span></blockquote><span class="o"><span><a name='more'></a></span></span></pre></div><div class="section" id="manual-installation">
<h2>Manual Installation<a class="headerlink" href="http://docs.ajenti.org/en/latest/man/install.html#manual-installation" title="Permalink to this headline"></a></h2>
<div class="section" id="native-dependencies-debian-ubuntu">
<h3>Native dependencies: Debian/Ubuntu<a class="headerlink" href="http://docs.ajenti.org/en/latest/man/install.html#native-dependencies-debian-ubuntu" title="Permalink to this headline"></a></h3>
<p>Enable Universe repository (Ubuntu only):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n"></span></pre></div></div><blockquote><div class="highlight-default notranslate"><div class="highlight"><pre><span class="n">sudo</span> <span class="n">add</span><span class="o">-</span><span class="n">apt</span><span class="o">-</span><span class="n">repository</span> <span class="n">universe</span>
</pre></div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span><span class="o">-</span><span class="n">get</span> <span class="n">install</span> <span class="n">build</span><span class="o">-</span><span class="n">essential</span> <span class="n">python3</span><span class="o">-</span><span class="n">pip</span> <span class="n">python3</span><span class="o">-</span><span class="n">dev</span> <span class="n">python3</span><span class="o">-</span><span class="n">lxml</span> <span class="n">libssl</span><span class="o">-</span><span class="n">dev</span> <span class="n">python3</span><span class="o">-</span><span class="n">dbus</span> <span class="n">python3</span><span class="o">-</span><span class="n">augeas</span> <span class="n">python3</span><span class="o">-</span><span class="n">apt</span> <span class="n">ntpdate</span>
</pre></div></div></blockquote><div class="highlight-default notranslate"><div class="highlight"><pre></pre></div>
</div>
</div>
<div class="section" id="native-dependencies-rhel-centos">
<h3>Native dependencies: RHEL/CentOS<a class="headerlink" href="http://docs.ajenti.org/en/latest/man/install.html#native-dependencies-rhel-centos" title="Permalink to this headline"></a></h3>
<p>Enable EPEL repository:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n"></span></pre></div></div><blockquote><div class="highlight-default notranslate"><div class="highlight"><pre><span class="n">sudo</span> <span class="n">dnf</span> <span class="n">install</span> <span class="n">epel</span><span class="o">-</span><span class="n">release</span>
</pre></div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">dnf</span> <span class="n">install</span> <span class="o">-</span><span class="n">y</span> <span class="n">gcc</span> <span class="n">python3</span><span class="o">-</span><span class="n">devel</span> <span class="n">python3</span><span class="o">-</span><span class="n">pip</span> <span class="n">python3</span><span class="o">-</span><span class="n">pillow</span> <span class="n">python3</span><span class="o">-</span><span class="n">augeas</span> <span class="n">python3</span><span class="o">-</span><span class="n">dbus</span> <span class="n">chrony</span> <span class="n">openssl</span><span class="o">-</span><span class="n">devel</span>
</pre></div></div></blockquote><div class="highlight-default notranslate"><div class="highlight"><pre></pre></div>
</div>
</div>
<div class="section" id="install-ajenti-2">
<h3>Install Ajenti 2<a class="headerlink" href="http://docs.ajenti.org/en/latest/man/install.html#install-ajenti-2" title="Permalink to this headline"></a></h3>
<p>Upgrade PIP:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n"></span><blockquote><span class="n">sudo</span> <span class="n">pip3</span> <span class="n">install</span> <span class="n">setuptools</span> <span class="n">pip</span> <span class="n">wheel</span> <span class="o">-</span><span class="n">U</span>
</blockquote></pre></div>
</div>
<p>Minimal install:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n"></span></pre></div></div><blockquote><div class="highlight-default notranslate"><div class="highlight"><pre><span class="n">sudo</span> <span class="n">pip3</span> <span class="n">install</span> <span class="n">ajenti</span><span class="o">-</span><span class="n">panel</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">core</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">dashboard</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">settings</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">plugins</span>
</pre></div>
</div>
<p></p></blockquote><div> </div><blockquote><p>With all plugins:</p></blockquote><p></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n"></span><blockquote><span class="n">sudo</span> <span class="n">pip3</span> <span class="n">install</span> <span class="n">ajenti</span><span class="o">-</span><span class="n">panel</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">ace</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">augeas</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">auth</span><span class="o">-</span><span class="n">users</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">core</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">dashboard</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">datetime</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">filemanager</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">filesystem</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">network</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">notepad</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">packages</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">passwd</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">plugins</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">power</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">services</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">settings</span> <span class="n">ajenti</span><span class="o">.</span><span class="n">plugin</span><span class="o">.</span><span class="n">terminal</span>
</blockquote></pre></div>
</div>
</div>
</div>
<hr />datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com9tag:blogger.com,1999:blog-6563619442555867219.post-77892049157220030742019-11-15T10:08:00.001-08:002019-11-15T10:08:15.418-08:00SolusVM Master on CentOS 7When moving a master from one server to another I came across a few issues with the new (v4) installer for SolusVM and CentOS 7. <br /><br />The server was loaded with the minimal install of CentOS, and there is no specific information on SolusVM’s site for dependencies. <br /><br />The first time I ran the install script, it never stated that there was a problem, but the back end web server was not accepting connections.<br /><br />Long story short, before you run the SolusVM installer for CentOS 7, run the following command to ensure that the software needed is in place:<br />
<a name='more'></a><br /><br />yum -y install rrdtool-php.x86_64 nmap.x86_64 vim-enhanced mlocate rsyslog.x86_64 php<br /><br />For reference, here is the command from the SolusVM website for the CentOS 7 install script:<br /><br />wget http://files.soluslabs.com/install.sh<br />sh install.sh<br />datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com4tag:blogger.com,1999:blog-6563619442555867219.post-59852179609599902062019-10-31T08:37:00.000-07:002019-10-31T08:37:23.953-07:00How to block an IP?If you want to stop someone from visiting your website, you can use the IP Blocker interface within cPanel which allows you to block access to your site for one or more IP addresses or fully qualified domain names (FQDNs).<br /><br />You can easily block an IP in cPanel by following these steps:<br /><br />1) Log into cPanel.<br />2) Look for the “SECURITY” section and click on “IP Blocker” icon.<br />3) You can add a single IP, an IP range or a domain name to the block list, click the “Add” button to set the block.<br />4) If you scroll down on the same page, you’ll see a list of all the blocked IPs, from here you can also delete an IP from the block list.<br /><br />Rock on.datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-75544120861888816782019-10-31T08:33:00.000-07:002019-10-31T08:33:18.206-07:00How to ban any IP Address via .htaccessIf someone is trying to hack your website or you want to block their IP Address, you can add this line to your .htaccess file.<br /><br /><span style="color: red;">order allow,deny<br />deny from IP-ADDRESS<br />allow from all</span><br /><br />Replace “IP-ADDRESS” with the IP Address you want to block.<br /><br />Rock on.datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com1tag:blogger.com,1999:blog-6563619442555867219.post-9842216384747905512019-10-31T08:29:00.000-07:002019-10-31T08:29:25.125-07:00Set Password or SSH Key for CentOS Cloud Images using virt-sysprep<b>Step 1: Install virt-sysprep</b><br /><br />Type the following apt-get command/apt command to install virt-sysprep on a Debian or Ubuntu Linux:<br /><br /><span style="color: red;">$ sudo apt install libguestfs-tools</span><br /><br /><br />If you are using a CentOS/RHEL/Oracle/Scientific Linux, type the following yum command:<br /><br /><span style="color: red;">$ sudo yum install libguestfs-tools</span><br /><br /><br />If you are using a Fedora Linux, type the following dnf command to install the same:<br />
<a name='more'></a><br /><span style="color: red;">$ sudo dnf install libguestfs-tools</span><br /><br /><br /><b>Step 2: Download cloud image in .qcow2 format</b><br /><br />You can grab cloud images from the following sites.<br /><br />For demo purpose I am downloading and using CentOS 7 image using wget command:<br /><br /><span style="color: red;">$ wget https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2.xz</span><br /><br /><br /><br />Use xz command for decompression:<br /><br /><br /><span style="color: red;">$ xz -v -d CentOS-7-x86_64-GenericCloud.qcow2.xz</span><br /><br /><br /><b>Step 3: Setup/inject an ssh keys</b><br /><br />To inject an ssh key to the given “USER” will be able to log in over ssh without supplying a password. The “USER” must exist already in the guest. For CentOS 7 username is centos:<br /><br /><span style="color: red;">$ sudo virt-sysprep -a CentOS-7-x86_64-GenericCloud.qcow2 \<br />--ssh-inject centos:file:/home/vyga/.ssh/id_rsa.pub</span><br /><br /><br /><b>Step 4: Launch a new VM using CentOS-7-x86_64-GenericCloud-1503.qcow2 image</b><br /><br />The syntax is:<br /><br /><span style="color: red;">$ virt-install --import \<br />--name centos7-vm1 \<br />--memory 1024 \<br />--vcpus 2 \<br />--cpu host \<br />--disk path=/var/lib/libvirt/images/centos7.qcow2,size=10,bus=virtio,format=qcow \<br />--os-type=linux \<br />--os-variant=centos7.0 \<br />--graphics spice \<br />--noautoconsole \<br />--disk /home/vyga/modifyisoimages/CentOS-7-x86_64-GenericCloud.qcow2</span><br /><br /><br /><b>Step 5: Test it with ssh</b><br /><br />To find out your VM's IP address run:<br /><br /><span style="color: red;">$ virsh net-list<br />$ virsh net-dhcp-leases default</span><br /><br /><br /><br />To log in using ssh command:<br /><br /><span style="color: red;">$ ssh user@vms-ip-address-here</span><br /><br />I can now start this image on the workstation and ssh in right away.<br /><br />Rock on.<br />datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com2tag:blogger.com,1999:blog-6563619442555867219.post-33931196690784332982019-10-26T13:49:00.001-07:002019-10-26T13:49:11.774-07:00How to Install MySQL on CentOS 7This guide will outlined how to install MySQL on CentOS 7. MySQL is a widely used database management platform used by various applications. Many applications such as WordPress, Joomla and others rely on MySQL databases to function. MySQL however, must be installed with a few different steps since it’s no longer the default in the CentOS repositories.<br /><br />All commands without sudo<br /><br /><span style="color: red;">yum update -y<br />yum install -y wget<br />wget http://repo.mysql.com/mysql-community-release-el7-7.noarch.rpm<br />rpm -ivh mysql-community-release-el7-7.noarch.rpm<br />yum update -y<br />yum install -y mysql-server<br />systemctl start mysqld<br />systemctl enable mysqld<br />mysql_secure_installation</span><br /><br />All commands with sudo<br />
<a name='more'></a><br /><span style="color: red;">sudo yum update -y<br />sudo yum install -y wget<br />sudo wget http://repo.mysql.com/mysql-community-release-el7-7.noarch.rpm<br />sudo rpm -ivh mysql-community-release-el7-7.noarch.rpm<br />sudo yum update -y<br />sudo yum install -y mysql-server<br />sudo systemctl start mysqld<br />sudo systemctl enable mysqld<br />sudo mysql_secure_installation</span><br />Prerequisites:<br /><br />First, before performing any steps relating to MySQL, we always want to update the system and ensure wget is installed:<br /><br /><span style="color: red;">yum update -y<br />yum install -y wget</span><br /><br />MySQL Installation:<br /><br />After you’ve installed wget and confirmed the system has updated, we can begin with the installation of MySQL. First we’ll need to download and add the repository. You’ll want to check the latest versions here: https://dev.mysql.com/downloads/repo/yum/ and here: http://repo.mysql.com/ and update the code snippet below accordingly for the rpm.<br /><br /><span style="color: red;">wget http://repo.mysql.com/mysql-community-release-el7-7.noarch.rpm<br />rpm -ivh mysql-community-release-el7-7.noarch.rpm<br />yum update -y</span><br /><br />After the repository has been added, we can proceed with installing MySQL<br /><br /><span style="color: red;">yum install -y mysql-server</span><br /><br />Once installed, we’ll need to start the service and then enable it to start on boot<br /><br /><span style="color: red;">systemctl start mysqld<br />systemctl enable mysqld</span><br /><br />MySQL has now been installed, started and should be running on your server. Please proceed to the next steps for the MySQL Secure Installation to further secure the install.<br /><br /><b>MySQL Secure Installation:</b><br /><br />Run the following command to begin securing the MySQL install. This process will give the options to remove the anonymous accounts, set a root password (other than your server root) and also remove the test databases. We highly recommend that you select YES to all of these options in addition to setting a different MySQL root password.<br /><br /><span style="color: red;">mysql_secure_installation</span><br /><br />After you have completed the installation steps above, MySQL has now been installed on your server. You can now proceed with adding & managing databases.<br />datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-27711104407050146792019-10-26T13:44:00.002-07:002019-10-26T13:44:14.722-07:00How to Disable SSH Login for the Root UserIn this document, we will show you to disable the SSH root login to your server.<br /><br />A major security hole is to allow direct root access without any restrictions. This is an open door for hackers. They can attempt to brute force your root password and potentially get access to your server if the password can be guessed.<br />
<br /><b>Quick Steps:</b><br /><br /><span style="color: red;">Login to the server via SSH.<br />Open the file “/etc/ssh/sshd_config” in any of your favorite text editors.<br />Find the section in the file containing the line with “#PermitRootLogin yes” in it.<br />Uncomment and change it to “PermitRootLogin no”.<br />Save the file and exit.<br />Restart the sshd service.</span><br /><br />Disabling SSH Login for Root<br /><br />The first step is to login to the server. Please note that you need to get more than one terminal access to the server because in case we lost one connection you can recover and get access to the server with the other one.<br /><br />Open the SSH configuration file with your text editor.<br />
<a name='more'></a><br /><span style="color: red;">vi /etc/ssh/sshd_config</span><br /><br />Locate the directive PermitRootLogin,<br /><br /><span style="color: red;">#PermitRootLogin yes</span><br /><br />Uncomment the line and change the directive No.<br /><br /><span style="color: red;">PermitRootLogin no</span><br /><br />Save and close the file. Restart the SSH daemon to save the changes by executing one of the commands below,<br /><br /><span style="color: red;">/etc/init.d/sshd restart<br />systemctl restart sshd<br />service sshd restart</span><br /><br />From now on, any attempt to SSH to the server with the root account will be automatically denied.<br />datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com1tag:blogger.com,1999:blog-6563619442555867219.post-6822261093382814082019-10-26T13:37:00.004-07:002019-10-26T13:37:34.185-07:00How do I create a custom php.ini file<div>
<span style="font-family: arial,helvetica,sans-serif; font-size: small;">A
custom php.ini file can be constructed and placed in your web account.
For instance, using a text editor such as Notepad, you can create a
php.ini file with the following custom setting which would override our
default server setting:</span></div>
<span style="font-size: small;"><br /></span>
<div>
<span style="color: red;"><span style="font-family: arial,helvetica,sans-serif; font-size: small;">file_uploads=off</span></span></div>
<span style="font-size: small;"><br /></span><span style="font-family: arial,helvetica,sans-serif; font-size: small;">The
php.ini file should only contain the custom settings - each on it's own
line (such as the above example). When completed, save the file and
upload it to an area (folder) on your web account where the rest of your
php files are located. <br /><br /><span style="color: red;">NOTE:
</span> The php.ini file should be uploaded into every folder and/or subfolder
where the settings need to take place. Be sure to rename your php.txt
file to php.ini before you upload it to your server.</span>datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-85576916458143633622019-10-26T12:10:00.002-07:002019-10-26T12:10:29.734-07:00Cron jobsA 'cron job' is an automated task that can be set up within your cPanel. This will typically be used to automate the running of a reminder script each day for example, or perhaps to run your own daily backup script. Any server task or script that needs regular scheduling is the perfect opportunity to use a cron job.<br /><br />We would ask that you be sparing with your use of cron jobs however, as a resource-intensive script executing every five minutes for example would clearly breach our acceptable use policy. Our recommendation would be to schedule cron jobs to run only as and when they are needed.<br /><br />Your online cPanel allows for the creation of cron jobs via a simple web interface. This is presented in plain english, and requires little understanding to operate.<br /><br />If you decide to use the "Advanced" option however, the following information may assist you in understanding how the system works.<br /><br />Understanding the format<br />
<a name='more'></a><br />r----Minute<br />| r-----Hour<br />| | r------Day of Month<br />| | | r------Month<br />| | | | r------Day of Week<br />| | | | | |------ Command to run -------------><br />| | | | | |<br />5 4 * * 0 /path/to/whatever/script.cgi<br /><br />The * symbol matches all possibilities. A "*" in the "Hour" column will for example ensure that the job is run every hour, on whichever minute(s) are specified.<br /><br />The weekday number runs from 0 to 6, where 0 = Sunday.<br /><br />Comma-separated values are accepted in each column, so "10,30,50" in the "Minute" column will run the cron job at 10 past, 30 past and 50 past whichever hour(s) are specified. Similarly, a value of */5 will ensure the job is run every five minutes on whichever hour(s) are specified.<br /><br />Examples<br /><br />5 4 * * 0 /path/to/whatever/script.cgi<br />Runs the script at 4:05 every sunday.<br /><br />*/5 * * * * lynx --dump http://site.com/script.php<br />Loads the page http://site.com/script.php every 5 minutes.<br /><br />5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out<br />Runs five minutes after midnight, every day<br /><br />Note: These timings correspond to the server time, which may differ from your local time. <br />datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-32421791511844540532019-10-26T12:07:00.001-07:002019-10-26T12:07:27.807-07:00How to host the Primary Domain from a subfolder (.htaccess)Your main domain will use the public_html directory for all of its website files by default. Addon domains use sub directories inside the public_html directory.<br /><br />In order to also set up your main domain to use a subdirectory on your hosting account you will need to set up a redirect in the .htaccess file in the public_html folder so that the server knows that any request for your main domain will be redirected to a subdirectory on public_html.<br /><br />Modifying the .htaccess<br /><br />The following code will need to be added to the .htaccess file in the public_html folder of your hosting account. You will need to insert the following code block and make modifications as noted in the (#) comments.<br /><br />You will need to change the two instances of example.com to your domain, and the three instances of subdirectory to the folder where you want your site.<br /><br /><span style="color: red;"># Hostingname.com (Your Hosting Name)<br /># .htaccess main domain to subdirectory redirect<br /># Do not change this line.<br />RewriteEngine on<br /># Change example.com to be your main domain.<br />RewriteCond %{HTTP_HOST} ^(www.)?example.com$<br /># Change 'subdirectory' to be the directory you will use for your main domain.<br />RewriteCond %{REQUEST_URI} !^/subdirectory/<br /># Don't change the following two lines.<br />RewriteCond %{REQUEST_FILENAME} !-f<br />RewriteCond %{REQUEST_FILENAME} !-d<br /># Change 'subdirectory' to be the directory you will use for your main domain.<br />RewriteRule ^(.*)$ /subdirectory/$1<br /># Change example.com to be your main domain again.<br /># Change 'subdirectory' to be the directory you will use for your main domain<br /># followed by / then the main file for your site, index.php, index.html, etc.<br />RewriteCond %{HTTP_HOST} ^(www.)?example.com$<br />RewriteRule ^(/)?$ subdirectory/index.html [L]</span><br /><br />Visitors to your website will not be able to tell that your main domain is using a subdirectory.<br /><br />Note: This method is not guaranteed to work with every script or software and can be used at your own discretion.<br />datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-4310775959450217872019-10-26T12:04:00.003-07:002019-10-26T12:04:33.436-07:00How to change the date.timezone value in PHP?<div class="kb-article-content">
If your PHP scripts do not show the correct time, the reason is
that most probably your hosting server is in a different timezone.<br />
<br />
This
can be easily resolved by changing a setting in PHP called <strong>date.timezone.</strong><br />
Depending on your location you can set a specific <strong>date.timezone</strong> value in PHP using the following option which should be added to your local php.ini file:<br />
<blockquote class="tr_bq">
<em>date.timezone = "US/Central" </em></blockquote>
<br />
The above example assumes you'd like to set the timezone for your PHP
scripts to US/Central. The full list of supported time zones is
available <span style="color: red;"><a href="http://www.php.net/manual/en/timezones.php" rel="nofollow" target="_blank">here</a></span> and you should simply replace <em>"US/Central"</em> with the desired timezone.<br />
</div>
datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-80914295827117560312019-10-26T11:23:00.000-07:002019-10-26T11:23:10.707-07:00Cron PHP | How To Run PHP Scripts From Cron Jobs?This article describes how to run PHP scripts from cron jobs.<br />
<br />
Running PHP scripts from cron jobs<br /><br />A common method for running PHP scripts from a cron job is to use a command-line program such as curl or wget. For example, the cron job runs a command similar to the following command:<br /><br />
<blockquote class="tr_bq">
curl http://example.com/script.php</blockquote>
<br />In this command, curl retrieves the web page, which then runs the PHP script.<br /><br />However, there is a better way to run PHP scripts on your web site from cron jobs. You can run the script directly by using the PHP command-line interpreter. This method is just as effective, and usually faster. The following command shows how to run a script using the PHP command-line interpreter:<br />
<a name='more'></a><br /><br />
<blockquote class="tr_bq">
php -q /home/<span style="color: red;">username</span>/public_html/script.php</blockquote>
<br />In this example, the PHP command-line interpreter runs the script.php file. The -q option enables quiet mode, which prevents HTTP headers from being displayed.<br /><br />Depending on the code in your PHP script, it may only run correctly when called from a specific directory. For example, if the script uses relative paths to include files, it will only run if it is called from the correct directory. The following command shows how to call a PHP script from a specific directory:<br /><br />
<blockquote class="tr_bq">
cd /home/<span style="color: red;">username</span>/public_html/; php -q script.php</blockquote>
<br />If your script requires special configuration options, you can use a custom php.ini file. The -c option allows you to call a PHP script using a custom php.ini file:<br /><br />
<blockquote class="tr_bq">
php -c /home/<span style="color: red;">username</span>/php.ini /home/<span style="color: red;">username</span>/public_html/script.php </blockquote>
<blockquote>
</blockquote>
datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-26885117027101661872019-06-23T12:51:00.000-07:002019-10-26T12:14:26.674-07:00cPanel EasyApache 4 Installing Redis and Redis PHP extensionInstalling the Redis daemon:<br />
for <b>CentOS 6/RHEL 6</b><br />
<pre class="hljs sql"><span style="color: red;"><code>rpm -ivh <a href="https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm" rel="nofollow" target="_blank">https://dl.fedoraproject.org/pub/epel/epel-<span class="hljs-keyword">release</span>-latest<span class="hljs-number">-6.</span>noarch.rpm</a>
rpm -ivh <a href="http://rpms.famillecollet.com/enterprise/remi-release-6.rpm" rel="nofollow" target="_blank"><span class="hljs-keyword">http</span>://rpms.famillecollet.com/<span class="hljs-keyword">enterprise</span>/remi-<span class="hljs-keyword">release</span><span class="hljs-number">-6.</span>rpm</a>
yum -y <span class="hljs-keyword">install</span> redis <span class="hljs-comment">--enablerepo=remi --disableplugin=priorities</span>
<span class="hljs-comment">chkconfig redis on</span>
<span class="hljs-comment">service redis start</span></code></span></pre>
<br />
<blockquote>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<pre class="hljs sql"><code> <span class="hljs-comment"></span></code></pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
for <b>CentOS 7/RHEL 7</b><br />
<pre class="hljs sql"><span style="color: red;"><code>rpm -ivh <a href="https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm" rel="nofollow" target="_blank">https://dl.fedoraproject.org/pub/epel/epel-<span class="hljs-keyword">release</span>-latest<span class="hljs-number">-7.</span>noarch.rpm</a>
rpm -ivh <a href="http://rpms.famillecollet.com/enterprise/remi-release-7.rpm" rel="nofollow" target="_blank"><span class="hljs-keyword">http</span>://rpms.famillecollet.com/<span class="hljs-keyword">enterprise</span>/remi-<span class="hljs-keyword">release</span><span class="hljs-number">-7.</span>rpm</a>
yum -y <span class="hljs-keyword">install</span> redis <span class="hljs-comment">--enablerepo=remi --disableplugin=priorities</span>
<span class="hljs-comment">systemctl enable redis</span>
<span class="hljs-comment">systemctl start redis</span></code></span></pre>
<br />
<blockquote>
<blockquote class="tr_bq">
<pre class="hljs sql"><code> <span class="hljs-comment"></span></code></pre>
</blockquote>
</blockquote>
<br />
<a name='more'></a><br />
Installing the Redis PHP extension for all available versions of PHP.<br />
<b>Copy and paste the entire block into SSH, don't do line by line.</b><br />
<br />
<span style="color: red;">for phpver in $(ls -1 /opt/cpanel/ |grep ea-php | sed 's/ea-php//g') ; do<br />cd ~<br />wget -O redis.tgz https://pecl.php.net/get/redis<br />tar -xvf redis.tgz<br />cd ~/redis* || exit<br />/opt/cpanel/ea-php"$phpver"/root/usr/bin/phpize<br />./configure --with-php-config=/opt/cpanel/ea-php"$phpver"/root/usr/bin/php-config<br />make clean && make install<br />echo 'extension=redis.so' > /opt/cpanel/ea-php"$phpver"/root/etc/php.d/redis.ini<br />rm -rf ~/redis*<br />done</span><br /><br />/scripts/restartsrv_httpd<br />/scripts/restartsrv_apache_php_fpm<b> </b><br />
<br />
<br />
<blockquote>
<blockquote class="tr_bq">
<pre class="hljs ruby"><code><span class="hljs-keyword"> </span><span class="hljs-regexp"></span></code></pre>
</blockquote>
</blockquote>
All done! Check to make sure the PHP extension is loaded in each version of PHP:<br />
<b>Copy and paste the entire block into SSH, don't do line by line.</b><br />
<br />
<span style="color: red;">for phpver in $(ls -1 /opt/cpanel/ |grep php | sed 's/ea-php//g') ; do<br />echo "PHP $phpver" ; /opt/cpanel/ea-php$phpver/root/usr/bin/php -i |grep "Redis Support"<br />done</span><b><span style="color: red;"> </span></b><br />
<blockquote>
<blockquote class="tr_bq">
<pre class="hljs ruby"><code><span class="hljs-keyword"></span>
</code></pre>
</blockquote>
</blockquote>
Output should be:<br />
<blockquote>
<blockquote class="tr_bq">
<pre class="hljs coq"><span style="color: red;"><code>PHP <span class="hljs-number">55</span>
Redis Support => enabled
PHP <span class="hljs-number">56</span>
Redis Support => enabled
PHP <span class="hljs-number">70</span>
Redis Support => enabled
PHP <span class="hljs-number">71</span>
Redis Support => enabled</code></span></pre>
</blockquote>
</blockquote>
datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-42976344895645612072019-06-09T06:07:00.000-07:002019-06-09T06:09:56.601-07:00How To Secure Apache<h3 id="introduction" style="background-color: white; box-sizing: border-box; color: #1fa67a; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 24px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
Introduction</h3>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Let’s Encrypt is a Certificate Authority (CA) that provides an easy way to obtain and install free TLS/SSL certificates, thereby enabling encrypted HTTPS on web servers. It simplifies the process by providing a software client, Certbot, that attempts to automate most (if not all) of the required steps. Currently, the entire process of obtaining and installing a certificate is fully automated on both Apache and Nginx. In this tutorial, you will use Certbot to obtain a free SSL certificate for Apache on Ubuntu 18.04 and set up your certificate to renew automatically.</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
This tutorial will use a separate Apache virtual host file instead of the default configuration file. We recommend creating new Apache virtual host files for each domain because it helps to avoid common mistakes and maintains the default files as a fallback configuration.</div>
<div data-unique="prerequisites" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
</div>
<h2 id="prerequisites" style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 28px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
Prerequisites</h2>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
To follow this tutorial, you will need:<br />
<br />
<a name='more'></a><br /></div>
<ul style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">One Ubuntu 18.04 server set up by following this initial server setup for Ubuntu 18.04 tutorial, including a sudo non-root user and a firewall.</li>
<li style="box-sizing: border-box;">A fully registered domain name. This tutorial will use <span style="box-sizing: border-box; font-weight: 700;">example.com</span> throughout. You can purchase a domain name on Namecheap, get one for free on Freenom, or use the domain registrar of your choice.</li>
<li style="box-sizing: border-box;">Both of the following DNS records set up for your server. You can follow this introduction to DigitalOcean DNS for details on how to add them.<ul style="box-sizing: border-box; margin-bottom: 0px; margin-top: 0px;">
<li style="box-sizing: border-box;">An A record with <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;"><span class="highlight" style="box-sizing: border-box;">example.com</span></code> pointing to your server’s public IP address.</li>
<li style="box-sizing: border-box;">An A record with <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">www.<span class="highlight" style="box-sizing: border-box;">example.com</span></code> pointing to your server’s public IP address.</li>
</ul>
</li>
<li style="box-sizing: border-box;">Apache installed by following How To Install Apache on Ubuntu 18.04. Be sure that you have a virtual host file for your domain. This tutorial will use <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">/etc/apache2/sites-available/<span class="highlight" style="box-sizing: border-box;">example.com</span>.conf</code>as an example.</li>
</ul>
<div data-unique="step-1-—-installing-certbot" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
</div>
<h2 id="step-1-—-installing-certbot" style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 28px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
Step 1 — Installing Certbot</h2>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
The first step to using Let’s Encrypt to obtain an SSL certificate is to install the Certbot software on your server.</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Certbot is in very active development, so the Certbot packages provided by Ubuntu tend to be outdated. However, the Certbot developers maintain a Ubuntu software repository with up-to-date versions, so we’ll use that repository instead.</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
First, add the repository:</div>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<ul class="prefixed" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; margin-top: 0px;">
<li class="line" style="box-sizing: border-box;">sudo add-apt-repository ppa:certbot/certbot</li>
</ul>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
You’ll need to press <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">ENTER</code> to accept. Then, update the package list to pick up the new repository’s package information:</div>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<ul class="prefixed" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; margin-top: 0px;">
<li class="line" style="box-sizing: border-box;">sudo apt update</li>
</ul>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
And finally, install Certbot’s Apache package with <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">apt</code>:</div>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<ul class="prefixed" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; margin-top: 0px;">
<li class="line" style="box-sizing: border-box;">sudo apt install python-certbot-apache</li>
</ul>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Certbot is now ready to use, but in order for it to configure SSL for Apache, we need to verify some of Apache’s configuration.</div>
<div data-unique="step-2-—-set-up-the-ssl-certificate" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
</div>
<h2 id="step-2-—-set-up-the-ssl-certificate" style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 28px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
Step 2 — Set Up the SSL Certificate</h2>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Certbot needs to be able to find the correct virtual host in your Apache configuration for it to automatically configure SSL. Specifically, it does this by looking for a <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">ServerName</code> directive that matches the domain you request a certificate for.</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
If you followed the virtual host set up step in the Apache installation tutorial, you should have a VirtualHost block for your domain at <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">/etc/apache2/sites-available/<span class="highlight" style="box-sizing: border-box;">example.com</span>.conf</code> with the <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">ServerName</code>directive already set appropriately.</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
To check, open the virtual host file for your domain using <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">nano</code> or your favorite text editor:</div>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<ul class="prefixed" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; margin-top: 0px;">
<li class="line" style="box-sizing: border-box;">sudo nano /etc/apache2/sites-available/<span class="highlight" style="box-sizing: border-box;">example.com</span>.conf</li>
</ul>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Find the existing <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">ServerName</code> line. It should look like this:</div>
<div class="code-label " style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;" title="/etc/apache2/sites-available/example.com.conf">
/etc/apache2/sites-available/example.com.conf</div>
<pre class="code-pre " style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code class="code-highlight language-apache hljs " style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">...
<span class="hljs-keyword" style="box-sizing: border-box;"><span class="hljs-common" style="box-sizing: border-box;">ServerName</span></span> <span class="highlight" style="box-sizing: border-box;">example.com</span>;
...
</code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
If it does, exit your editor and move on to the next step.</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
If it doesn’t, update it to match. Then save the file, quit your editor, and verify the syntax of your configuration edits:</div>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<ul class="prefixed" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; margin-top: 0px;">
<li class="line" style="box-sizing: border-box;">sudo apache2ctl configtest</li>
</ul>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
If you get an error, reopen the virtual host file and check for any typos or missing characters. Once your configuration file’s syntax is correct, reload Apache to load the new configuration:</div>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<ul class="prefixed" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; margin-top: 0px;">
<li class="line" style="box-sizing: border-box;">sudo systemctl reload apache2</li>
</ul>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Certbot can now find the correct VirtualHost block and update it.</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Next, let’s update the firewall to allow HTTPS traffic.</div>
<div data-unique="step-3-—-allowing-https-through-the-firewall" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
</div>
<h2 id="step-3-—-allowing-https-through-the-firewall" style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 28px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
Step 3 — Allowing HTTPS Through the Firewall</h2>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
If you have the <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">ufw</code> firewall enabled, as recommended by the prerequisite guides, you’ll need to adjust the settings to allow for HTTPS traffic. Luckily, Apache registers a few profiles with <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">ufw</code> upon installation.</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
You can see the current setting by typing:</div>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<ul class="prefixed" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; margin-top: 0px;">
<li class="line" style="box-sizing: border-box;">sudo ufw status</li>
</ul>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
It will probably look like this, meaning that only HTTP traffic is allowed to the web server:</div>
<pre class="code-pre " style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<div class="secondary-code-label " style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;" title="Output">
Output</div>
<pre class="code-pre " style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">Status: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
Apache ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
Apache (v6) ALLOW Anywhere (v6)
</code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
To additionally let in HTTPS traffic, allow the Apache Full profile and delete the redundant Apache profile allowance:</div>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<ul class="prefixed" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; margin-top: 0px;">
<li class="line" style="box-sizing: border-box;">sudo ufw allow ‘Apache Full’</li>
<li class="line" style="box-sizing: border-box;">sudo ufw delete allow ‘Apache’</li>
</ul>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Your status should now look like this:</div>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<ul class="prefixed" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; margin-top: 0px;">
<li class="line" style="box-sizing: border-box;">sudo ufw status</li>
</ul>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<pre class="code-pre " style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<div class="secondary-code-label " style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;" title="Output">
Output</div>
<pre class="code-pre " style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">Status: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
Apache Full ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
Apache Full (v6) ALLOW Anywhere (v6)
</code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Next, let’s run Certbot and fetch our certificates.</div>
<div data-unique="step-4-—-obtaining-an-ssl-certificate" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
</div>
<h2 id="step-4-—-obtaining-an-ssl-certificate" style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 28px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
Step 4 — Obtaining an SSL Certificate</h2>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Certbot provides a variety of ways to obtain SSL certificates through plugins. The Apache plugin will take care of reconfiguring Apache and reloading the config whenever necessary. To use this plugin, type the following:</div>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<ul class="prefixed" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; margin-top: 0px;">
<li class="line" style="box-sizing: border-box;">sudo certbot –apache -d <span class="highlight" style="box-sizing: border-box;">example.com</span> -d <span class="highlight" style="box-sizing: border-box;">www.example.com</span></li>
</ul>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
This runs <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">certbot</code> with the <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">--apache</code> plugin, using <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">-d</code> to specify the names you’d like the certificate to be valid for.</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
If this is your first time running <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">certbot</code>, you will be prompted to enter an email address and agree to the terms of service. After doing so, <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">certbot</code> will communicate with the Let’s Encrypt server, then run a challenge to verify that you control the domain you’re requesting a certificate for.</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
If that’s successful, <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">certbot</code> will ask how you’d like to configure your HTTPS settings:</div>
<pre class="code-pre " style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<div class="secondary-code-label " style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;" title="Output">
Output</div>
<pre class="code-pre " style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):
</code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Select your choice then hit <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">ENTER</code>. The configuration will be updated, and Apache will reload to pick up the new settings. <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">certbot</code> will wrap up with a message telling you the process was successful and where your certificates are stored:</div>
<pre class="code-pre " style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<div class="secondary-code-label " style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;" title="Output">
Output</div>
<pre class="code-pre " style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/<span class="highlight" style="box-sizing: border-box;">example.com</span>/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/<span class="highlight" style="box-sizing: border-box;">example.com</span>/privkey.pem
Your cert will expire on 2018-07-23. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
</code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Your certificates are downloaded, installed, and loaded. Try reloading your website using <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">https://</code> and notice your browser’s security indicator. It should indicate that the site is properly secured, usually with a green lock icon. If you test your server using the SSL Labs Server Test, it will get an <span style="box-sizing: border-box; font-weight: 700;">A</span> grade.</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Let’s finish by testing the renewal process.</div>
<div data-unique="step-5-—-verifying-certbot-auto-renewal" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
</div>
<h2 id="step-5-—-verifying-certbot-auto-renewal" style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 28px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
Step 5 — Verifying Certbot Auto-Renewal</h2>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Let’s Encrypt’s certificates are only valid for ninety days. This is to encourage users to automate their certificate renewal process. The <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">certbot</code> package we installed takes care of this for us by adding a renew script to <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">/etc/cron.d</code>. This script runs twice a day and will automatically renew any certificate that’s within thirty days of expiration.</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
To test the renewal process, you can do a dry run with <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">certbot</code>:</div>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<ul class="prefixed" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; margin-top: 0px;">
<li class="line" style="box-sizing: border-box;">sudo certbot renew –dry-run</li>
</ul>
<pre class="code-pre command" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"></code></pre>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
If you see no errors, you’re all set. When necessary, Certbot will renew your certificates and reload Apache to pick up the changes. If the automated renewal process ever fails, Let’s Encrypt will send a message to the email you specified, warning you when your certificate is about to expire.</div>
datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-44376813740816245552019-06-08T14:12:00.001-07:002019-06-08T14:12:51.535-07:00Apache vs NginxWeb server is essential for all server to serve the content over the internet. There are a lot of web servers available in the market. The two Major web servers are Apache and Nginx. A lot of people are confusing themselves about choosing the one among both of them. In this article, I am going to compare Apache and Nginx which will give the answer to your confusion. Both of these web servers can’t be replaced by each other. They have their uniqueness. You have to choose any of the web server based on the requirement. In this article, we will also see the nginx vs apache difference.<br />
<br />
Here: I am going to compare Apache and Nginx with following factors<br />
<br />
Connection Handling architecture<br />
Static vs Dynamic content<br />
Distributed vs Centralized configuration<br />
File vs URI based interpretation<br />
Modules<br />
Compatibility<br />
Using both of them together.<br />
Apache<br />
Apache was initially created by Robert McCool. The year of creation was 1995. After that, Apache has been developed by Apache software foundation from 1999. The actual organization is HTTP web server. But the foundation is now referred with the name of Apache. The Product name overrides the organization name. It becomes very famous after its launch since then the Apache foundation is benefiting from the documentation and integration with software. Apache is the first choice for many server administrators due to its power, compatibility and support for many platforms. The Apache is easily extensible through loading the dynamic module. Apache process many interpreted languages and it does not use any other external software for that.<br />
<br />
<a name='more'></a><br /><br />
Nginx<br />
The Origin of Nginx is an interesting thing. The Nginx was created by Igor Sysoev. Nginx was created as a solution for the c10K problem. At that time, it was very hard to serve a large number of concurrent users. Even the Apache was struggling to handle the traffic. It was a challenge to serve 10,000 concurrent visitors at a time. Igor Sysoev created Nginx as a solution to this. It was created to handle a large number of concurrent users with limited resources. Nginx performed well and managed a large number of concurrent users with minimal resources. After that, it becomes very famous. The Administrators who handle the server with a large number of concurrent visitors started to use Nginx. Nginx Performs well even at heavy loads. Nginx has some advanced features. They are Reverse Proxy Load Balancing Many people want to know difference between apache and nginx server. Let us see them here.<br />
1) Connection Handling Architecture<br />
Let us see how Apache and Nginx are handling the connections with their client.<br />
<br />
Apache:<br />
Apache provides various multiprocessing modules to handle the client request.<br />
<br />
The administrator can easily change the Multi-Processing Module(MPM).<br />
<br />
mpm_prefork: This module creates processes with a thread for each.<br />
<br />
Each thread handles a single request. This module works faster until the number of request crosses the number of processes.<br />
<br />
The process will consume memory so it makes the server slow down.<br />
<br />
It is not easy to scale up when the process is high.<br />
<br />
This module is best for working with other components which are not created to depend on threads.<br />
<br />
PHP is not fit to work with thread. This mpm_prefork module is best to work with PHP.<br />
<br />
This is the only safe way to work with PHP using mod_php apache module.<br />
<br />
mpm_worker: This module creates processes each with multiple threads.<br />
<br />
Many threads mean handling of many connections. This module is much more efficient than Prefork Module.<br />
<br />
This time new client request can be caught by a thread. So, there is no need of waiting for the process to become free.<br />
<br />
MPM worker is scaling better than Prefork Module.<br />
<br />
mpm_event: This module is somewhat similar to mpm_worker.<br />
<br />
In the mpm_event a connection is kept alive regardless of whether the request is being made as long as the connection exists.<br />
<br />
mpm_event also handles threads of Keep-Alive connection requests.<br />
<br />
It sets dedicated threads of keep-alive connection and sends the remaining requests to other threads.<br />
<br />
This helps the Process to prevent being filled with keep-alive connection requests.<br />
<br />
Keepalive connection should be stable and fixed with the specific threads. So the dedicated thread is the must.<br />
<br />
You could see the availability of request handling algorithms in Apache. T<br />
<br />
he variation is created for different usages.<br />
<br />
Web administrator can choose the module based on the server capability.<br />
<br />
However, The internet is growing so the concurrency is also growing with that.<br />
<br />
Nginx:<br />
The Nginx is created with the purpose of serving more requests simultaneously without any interruption with minimal resource.<br />
<br />
The Apache was struggling to handle a large number of user concurrently, this is where Nginx came in and performed well.<br />
<br />
After that, it started to gain attention from webmasters.<br />
<br />
The Nginx is preferable for servers with a large number of visitors.<br />
<br />
Nginx is best in delivering the static content and almost works two times faster than Apache.<br />
<br />
Nginx is growing faster as many webmasters started to using it for its performance. But, at the same time, the Usage of Apache web server also becoming low.<br />
<br />
Most of the time Apache web server is replaced by Nginx server.<br />
<br />
Nginx is working completely in a different way when compared to Apache web server.<br />
<br />
Nginx has one main master process.It is recommended to have one master process per CPU.<br />
<br />
The master process creates multiple worker processes. Each worker process has only one thread.<br />
<br />
This is where Nginx differs from Apache.<br />
<br />
Single Nginx threads serve multiple requests whereas in Apache single thread only serves one connection.<br />
<br />
The worker process connections are placed in event loop with other connections and all of them are served asynchronously.<br />
<br />
Once the request is served completely, the event will be removed from the loop.<br />
<br />
Since a single thread handles the multiple connections, No need of creation of the additional process which leads to memory and CPU consumption.<br />
<br />
So, Nginx serves without going down even when the load is heavy.<br />
<br />
Checkout this forum to see the nginx vs apache 2017 comparison.<br />
<br />
2) Static vs Dynamic content<br />
Static content serving:<br />
<br />
Nginx is leading in this contest and performed 2.5 times faster than Apache in serving static content when tested with 1000 concurrent connections.<br />
<br />
In another test with 512 concurrent connections to Nginx, it performed 2 times faster than Apache at the same time Nginx consumed 4% less memory.<br />
<br />
So, if you are serving the static content to a lot of concurrent users, then you should choose Nginx as the new web server.<br />
<br />
When you go for Nginx vs Apache WordPress, both of them are almost giving same performance for<br />
<br />
Dynamic Content Serving:<br />
<br />
Now, most of the website is running based on Dynamic content. It essential for any web server to serve the dynamic content faster.<br />
<br />
During the test for the Dynamic content, Nginx and Apache both performed equally.<br />
<br />
They also consumed same memory and CPU Resource.<br />
<br />
There are a lot of websites uses CMS such as WordPress, Joomla and Drupal.<br />
<br />
The web server also needs to serve the dynamic content from them.<br />
<br />
Here, both of the web servers are doing the same task “that is forwarding dynamic content requests to php-fpm and wait for its process and response the request, then they serve the content to the client.<br />
<br />
When you go for Nginx vs Apache php, the Apache directly works with PHP whereas the Nginx uses php-fpm.<br />
<br />
Both web servers are depending the third party to process the request.<br />
<br />
Until then they serve the static content without waiting for the process to complete.<br />
<br />
So, you can choose any of the web servers to serve dynamic contents as they don’t show any difference in the performance.<br />
<br />
3) Operating System<br />
Apache:<br />
Apache supports all the Linux and Unix-like operating system and works on them perfectly.<br />
<br />
Apache also completely supports the Microsoft Windows.<br />
<br />
Nginx:<br />
Nginx also highly supports Linux and Unix-like operating system.<br />
<br />
But:<br />
<br />
Only provides some support to windows. However, this can’t stop from running the web server.(Most of the hosting servers are running on Linux)<br />
<br />
4) .Htaccess<br />
The main difference between Apache and Nginx is directory level configuration.<br />
<br />
Apache:<br />
In Apache web server, you can use the directives to control a web directory. The directives will be hidden in a file called .htacess.<br />
<br />
== The .htaccess file is powerful and lets you control some aspects of web server directly without accessing the web server configuration file.==<br />
<br />
The directives written within this file are so effective and the result reflects immediately without restarting the server.<br />
<br />
You have to be careful while handling the .htaccess. Even a small mistake can cause trouble to your site.<br />
<br />
Apache will always look for .htaccess file in the parent directory. Once it finds the directory, It reads the directives<br />
<br />
Here are the few things which you can control using .htaccess.<br />
<br />
URL rewrites,<br />
Access restrictions,<br />
Authorization<br />
Authentication<br />
Caching policies<br />
It allows the decentralized configuration by giving access to CMS.<br />
<br />
This will help server administrators to give some specific access to the webmasters in the shared hosting.<br />
<br />
So, the webmasters can have some control over their site and they can further customize it.<br />
<br />
Nginx:<br />
Nginx does not interpret any such files. Nginx does not provide any option like .htaccess.<br />
<br />
All the access are centralized and you have to make all changes in the main configuration file.<br />
<br />
It may seem a backdrop for Nginx when compared to Apache, but it has the advantage.<br />
<br />
In Apache, the server will look for .htaccess directory in the corresponding directory and it entirely searches for the hidden files in the parent directory.<br />
<br />
It is a time-consuming process. After finding the. htaccess file, the server will interpret the directives and fetches the directory contents to the user.<br />
<br />
If there are more .htaccess file, they all should be interpreted.<br />
<br />
This process will happen again and again for the each request made to the server.<br />
<br />
But:<br />
<br />
Nginx directly reads the directories and deliver the content to the user according to its main configuration directives.<br />
<br />
This saves a lot of time and delivers the content faster. This is one of the reason for Nginx to work faster.<br />
<br />
Also, the security is high since the Configuration is centralized.<br />
<br />
The web server has all the control over the configuration. Individual users have to contact the admin for any changes that have to be made.<br />
<br />
It also prevents the user from making suspicious activities with .htaccess file.<br />
<br />
5) Working Model<br />
Apache:<br />
You can make a request to Apache that can be interpreted as a Physical resource on a file system.<br />
<br />
The request can also be made in the form of URI.<br />
<br />
Apache has been using Directory blocks and location blocks. File blocks are also used instead of Directory blocks.<br />
<br />
The location block is used for more abstract resources.<br />
<br />
Apache is entirely created as a web server. It interprets the request as File system resources.<br />
<br />
To get a file, Apache begins the search from document root with the host and port number along with the request.<br />
<br />
Apache has many options when the search for file end up in not finding the file. You can use alias directive to represent the alternative location of the file.<br />
<br />
If you want to use Location block instead of the file system, you have to use URI.<br />
<br />
You can use the available regular expression to configure the file system with flexibility.<br />
<br />
Apache can work as both underlying file system and web space. The file system is the one the Apache depends on the most.<br />
<br />
The .htaccess is one such example for the file system dependency of Apache.<br />
<br />
Nginx:<br />
Nginx works both as a web server and proxy. The Architecture of Nginx differs a lot from apache. Due to this, Nginx uses the URI mainly and uses the file system when required.<br />
<br />
You can see that the way of Nginx configuration file is created and interpreted.<br />
<br />
Nginx does not allow you to specify the configuration for a directory. Instead, it directly parses the URI itself.<br />
<br />
Nginx uses two primary blocks. They are server block and location blocks.<br />
<br />
The server block interprets the hostname and the location block interprets URI which comes after the host and port.<br />
<br />
The request is interpreted as URI, not as location file system.<br />
<br />
If a user is requesting for a static file, the Nginx selects the server block and location block. Also, the Nginx appends the document root with the URI.<br />
<br />
The function may seem similar.<br />
<br />
But actually, it is not. Parsing the request as URI instead of File system lets the Nginx function easily as web, email and proxy server.<br />
<br />
Nginx configuration responds the request as mentioned in the configuration.<br />
<br />
6) Modules:<br />
You can extend both Apache and Nginx using the module. The function style of Apache and Nginx Differs a lot from each other.<br />
<br />
Apache:<br />
you can use the module according to the requirement. Load and unload the modules easily to meet the requirement of the server.<br />
<br />
You can turn off and turn on the Modules easily. Each module provides different functionalities.<br />
<br />
Apache is very old has been serving for a long time in the internet world. A lot of libraries have been created for Apache.<br />
<br />
You can use install any of the modules to change and add functions in the Apache.<br />
<br />
For example, The mod_php adds the PHP interpreter to each worker in Apache.<br />
<br />
The modules are not only serving the dynamic content. They have more functionality than you think. Here is some of them.<br />
<br />
Rewriting URLs<br />
Authenticating clients<br />
Hardening the server<br />
Logging<br />
Caching<br />
Compression<br />
Proxying<br />
Rate limiting<br />
Encrypting<br />
The core functionality can be extended using the dynamic module.<br />
<br />
Nginx:<br />
Nginx also has various modules to support the user requirement. But, there is a major difference between the Apache and Nginx modules.<br />
<br />
Nginx modules are not dynamically loadable. You have to add them yourself in the core software.<br />
<br />
This is not an easy task for many users to build their server from the core with their selected packages.<br />
<br />
It will be much harder for people who use the conventional packaging system which consists the commonly required modules.<br />
<br />
If you have a specific requirement, then you have to build the server from the core using required modules.<br />
<br />
Nginx Modules can be instructed to do specific tasks so that you can get what you want. This is also considered as a more secure way by many users.<br />
<br />
Nginx modules have many functionalities same as Apache modules. Here is some of them.<br />
<br />
proxying support<br />
compression<br />
rate limiting<br />
logging<br />
rewriting<br />
geolocation<br />
authentication<br />
encryption<br />
streaming<br />
mail functionality<br />
8) Support, Compatibility, Ecosystem, and Documentation<br />
If you are using a software, you always need the support and help to use that for a long time.<br />
<br />
It is the responsibility of the software provider too.<br />
<br />
Apache:<br />
Apache is a popular web server and it has been in the market for a very long time.<br />
<br />
It has been serving in the internet world for more than two decades.<br />
<br />
This very long time existence of Apache is its greatest advantages.<br />
<br />
Being the first famous vendor in the internet Apache has been widely used by many people.<br />
<br />
There are a lot of documentation are available.<br />
<br />
The third party documentation is also available. A lot of web software tool is available to bootstrap in the Apache environment.<br />
<br />
A lot of third party supports are available for Apache since it has been evolving in the market for a long time and holds more share in the market.<br />
<br />
Server administrators familiar with Apache.<br />
<br />
It is also used in the shared hosting for its one of the best feature .htaccess file.<br />
<br />
The distributed configuration environment gives access to the webmasters to take control over their website.<br />
<br />
Nginx:<br />
Nginx has been serving the internet for more than a decade. Nginx has the third place in the web server market.<br />
<br />
A lot of people have been choosing Nginx as their web server.<br />
<br />
The growth of the Nginx is so fast and it very high when compared to Apache growth throughout the last decade.<br />
<br />
Due to the speed, Many server admins adopted Nginx.<br />
<br />
Initially, the detailed documentation of the Nginx is not available in the English language.<br />
<br />
The initial documentation was in the Russian Language.<br />
<br />
But:<br />
<br />
After some time, the interest of the project has grown and the documentation has been converted to English. The Nginx itself has a lot of administration resource to handle the Nginx.<br />
<br />
A large number of third parties also providing resources. This makes a one to choose Nginx.<br />
<br />
A lot of third-party application gives you an option to auto-configure Nginx.<br />
<br />
If you don’t have Nginx on your server, they automatically download and configure Nginx for their application to work on your machine.<br />
<br />
If you need to install the Nginx for any third party applications, it will be easy for you.<br />
<br />
It is because they provide clear documentation about the requirement for that applications.<br />
<br />
It makes your job very easy to create a custom Nginx server.<br />
<br />
9) Using Apache and Nginx together<br />
You have seen the difference and limitations of Nginx and Apache. Now you should have decided which one is the best suit for your server.<br />
<br />
When you look at Nginx vs apache reverse proxy, both are giving best performance for dynamic content.<br />
<br />
But:<br />
<br />
You can use both of them together to benefit from both web server software.<br />
<br />
You can use Nginx as a reverse proxy in front of Apache.<br />
<br />
The main advantage of Nginx is concurrency and speed of delivering static content.<br />
<br />
If a user requests for static content, it can be served immediately by Nginx directly. If a user requests for dynamic content, the Nginx forwards the request to the Apache.<br />
<br />
Apache process the request and forwards to the content to the Nginx. Then Nginx forwards the content to the user.<br />
<br />
This is a suggested and well-working setup for many people. The Nginx and Apache together share the workload.<br />
<br />
First Nginx receives the request. If it has the ability to process the request, It will respond to the request.<br />
<br />
If Nginx doesn’t have the ability to handle the request, then it will be forwarded to Apache.<br />
<br />
By making Nginx handle the part of the request, you will avoid the situation of Apache server threads are being occupied and become unable to respond the request.<br />
<br />
The biggest advantage is you can add more backend server to this setup. Nginx has the capability to handle many servers and it can even load balance between them.<br />
<br />
It can help you to scale up when required.<br />
<br />
Conclusion<br />
You have seen the above comparison between Nginx and Apache. The one thing you have to remind is “Nothing can entirely fulfill your requirements”.<br />
<br />
You have to choose the web server based on your major and important requirement.<br />
<br />
As mentioned above, you can use the Nginx and Apache combination.datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-1473324461433080952019-06-08T13:10:00.000-07:002019-06-08T13:10:37.604-07:00How To Install Apache on CentOS 7<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Apache HTTP server is the most popular web server in the world. It is a free, open-source and cross-platform HTTP server providing powerful features which can be extended by a wide variety of modules. The following instructions describe how to install and manage the Apache web server on your CentOS 7 machine.</div>
<h2 aria-hidden="true" class="anchor" id="install-apache" style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 28px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;" tabindex="-1">
Install Apache</h2>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Apache is available in the default CentOS repositories and the installation is pretty straight forward. On CentOS and RHEL the Apache package and the service is called <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">httpd</code>. To install the package run the following command:</div>
<div class="highlight" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
<pre class="chroma" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code class="language-bash" data-lang="bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">sudo yum install httpd</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
<br /></div>
</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Once the installation is completed, enable and start the Apache service:</div>
<div class="highlight" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
<pre class="chroma" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code class="language-bash" data-lang="bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"><span class="bash-line" style="box-sizing: border-box;">sudo systemctl enable httpd</span>
<span class="bash-line" style="box-sizing: border-box;">sudo systemctl start httpd</span></code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
</div>
<a name='more'></a><br /></div>
<h2 aria-hidden="true" class="anchor" id="adjust-the-firewall" style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 28px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
Adjust the Firewall</h2>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
If your server is protected by a firewall you need to open HTTP and HTTPS ports, <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">80</code> and <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">443</code>. Use the following commands to open the necessary ports:</div>
<div class="highlight" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
<pre class="chroma" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code class="language-bash" data-lang="bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;"><span class="bash-line" style="box-sizing: border-box;">sudo firewall-cmd --permanent --zone=public --add-service=http</span>
<span class="bash-line" style="box-sizing: border-box;">sudo firewall-cmd --permanent --zone=public --add-service=https</span>
<span class="bash-line" style="box-sizing: border-box;">sudo firewall-cmd --reload</span></code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
<span class="code-copy button main small" data-clipboard-text="sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=https sudo firewall-cmd --reload" style="box-sizing: border-box; font-size: 11.9px;">Copy</span></div>
</div>
<h2 aria-hidden="true" class="anchor" id="verifying-apache-installation" style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 28px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
Verifying Apache Installation</h2>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Now that we have Apache installed and running on our CentOS 7 server we can check the status and the version of the Apache service, with:</div>
<div class="highlight" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
<pre class="chroma" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code class="language-bash" data-lang="bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">sudo systemctl status httpd</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
<br /></div>
</div>
<div class="highlight" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
<pre class="chroma" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code class="language-output" data-lang="output" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2018-04-26 07:13:07 UTC; 11s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 3049 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─3049 /usr/sbin/httpd -DFOREGROUND
├─3050 /usr/sbin/httpd -DFOREGROUND
├─3051 /usr/sbin/httpd -DFOREGROUND
├─3052 /usr/sbin/httpd -DFOREGROUND
├─3053 /usr/sbin/httpd -DFOREGROUND
└─3054 /usr/sbin/httpd -DFOREGROUND</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
<br /></div>
</div>
<div class="highlight" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
<pre class="chroma" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code class="language-bash" data-lang="bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">sudo httpd -v</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
<br /></div>
</div>
<div class="highlight" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
<pre class="chroma" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code class="language-output" data-lang="output" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">Server version: Apache/2.4.6 (CentOS)
Server built: Oct 19 2017 20:39:16</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
<br /></div>
</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
Finally to verify if everything works properly, open your server IP address <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">http://YOUR_IP</code> in your browser of choice, and you will see the default CentOS 7 Apache welcome page as shown below:</div>
<h2 aria-hidden="true" class="anchor" id="manage-the-apache-service-with-systemctl" style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 28px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
Manage the Apache service with systemctl</h2>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
We can manage the Apache service same as any other systemd unit.</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
To stop the Apache service, run:</div>
<div class="highlight" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
<pre class="chroma" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code class="language-bash" data-lang="bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">sudo systemctl stop httpd</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
<br /></div>
</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
To start it again, type:</div>
<div class="highlight" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
<pre class="chroma" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code class="language-bash" data-lang="bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">sudo systemctl start httpd</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
<br /></div>
</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
To restart the Apache service:</div>
<div class="highlight" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
<pre class="chroma" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code class="language-bash" data-lang="bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">sudo systemctl restart httpd</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
<br /></div>
</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
To reload the Apache service after you made some configuration changes:</div>
<div class="highlight" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
<pre class="chroma" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code class="language-bash" data-lang="bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">sudo systemctl reload httpd</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
<br /></div>
</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
If you want to disable the Apache service to start at boot:</div>
<div class="highlight" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
<pre class="chroma" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code class="language-bash" data-lang="bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">sudo systemctl disable httpd</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
<br /></div>
</div>
<div style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px;">
And to re-enable it again:</div>
<div class="highlight" style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px;">
<pre class="chroma" style="background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;"><code class="language-bash" data-lang="bash" style="background-color: transparent; border-radius: 0px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: inherit; padding: 0px; white-space: pre-wrap;">sudo systemctl enable httpd</code></pre>
<div style="box-sizing: border-box; margin-bottom: 10px;">
<br /></div>
</div>
<hr style="background-color: white; border-bottom: 0px; border-image: initial; border-left: 0px; border-right: 0px; border-top-color: rgb(238, 238, 238); border-top-style: solid; box-sizing: content-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; height: 0px; margin-bottom: 20px; margin-top: 20px;" />
<h2 aria-hidden="true" class="anchor" id="apache-configuration-file-s-structure-and-best-practices" style="background-color: white; box-sizing: border-box; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 28px; font-weight: 500; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
Apache Configuration File’s Structure and Best Practices</h2>
<ul style="background-color: white; box-sizing: border-box; color: #6b6b6b; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;">All Apache configuration files are located in the <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">/etc/httpd</code> directory.</li>
<li style="box-sizing: border-box;">The main Apache configuration file is <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">/etc/httpd/conf/httpd.conf</code>.</li>
<li style="box-sizing: border-box;">All config files ending with <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">.conf</code> located in the <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">/etc/httpd/conf.d</code> directory are included in main Apache configuration file.</li>
<li style="box-sizing: border-box;">Configuration files which are responsible for loading various Apache modules are located in the <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">/etc/httpd/conf.modules.d</code> directory.</li>
<li style="box-sizing: border-box;">For better maintainability it is recommended to create a separate configuration file (vhost) for each domain.</li>
<li style="box-sizing: border-box;">New Apache vhost files must end with <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">.conf</code> and be stored in <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">/etc/httpd/conf.d</code>directory. You can have as many vhosts as you need.</li>
<li style="box-sizing: border-box;">It is a good idea to follow a standard naming convention, for example if your domain name is <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">mydomain.com</code> then you the configuration file should be named <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">/etc/httpd/conf.d/mydomain.com.conf</code></li>
<li style="box-sizing: border-box;">Apache log files (<code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">access_log</code> and <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">error_log</code>) are located in the <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">/var/log/httpd/</code> directory. It is recommended to have a different <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">access</code> and <code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">error</code> log files for each vhost.</li>
<li style="box-sizing: border-box;">You can set your domain document root directory to any location you want. The most common locations for webroot include:<ul style="box-sizing: border-box; margin-bottom: 0px; margin-top: 0px;">
<li style="box-sizing: border-box;"><code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">/home/<user_name>/<site_name></code></li>
<li style="box-sizing: border-box;"><code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">/var/www/<site_name></code></li>
<li style="box-sizing: border-box;"><code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">/var/www/html/<site_name></code></li>
<li style="box-sizing: border-box;"><code style="background-color: #f9f2f4; border-radius: 4px; box-sizing: border-box; color: #c7254e; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12.6px; padding: 2px 4px;">/opt/<site_name></code></li>
</ul>
</li>
</ul>
datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-70704395166959083512019-05-11T11:51:00.000-07:002019-05-11T11:51:02.622-07:00How to Secure your Server<span style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;">Here are some quick tips on how to secure your Linux server. This is only a short list, but, </span><strong style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;">they are must do’s</strong><span style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;">! Some of which are:</span><br style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;" /><br style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;" /><span style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;">1. Change ssh port (use keys if possible as well/allow only specific users)</span><br style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;" /><span style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;">2. Disable unneeded services</span><br style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;" /><span style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;">3. Install a good firewall</span><br style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;" /><span style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;">4. Disable dangerous / unused PHP functions / harden your PHP</span><br style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;" /><span style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;">5. Install mod_security</span><br style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;" /><span style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;">6. Virus scan FTP uploads</span><br style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;" /><span style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;">7. Install root kit detection</span><br style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;" /><span style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;">8. Set root email to off server email account</span><br style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;" /><span style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;">9. Make sure your passwords are tough to guess. This is a big one, especially for the root user, this should be a very tough password.</span><br style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;" /><br style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;" /><span style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13.2px;">This is a quick list, as there are many other things that can be done.</span>datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-7752291167319478972018-12-05T15:06:00.001-08:002018-12-05T15:06:43.459-08:00Optimize MySQL & Apache on cPanel/WHM serverOn this optimization process, we will go over the Apache core configuration and modules that are part of Apache core. We think that with the correct settings of Apache and MySQL you can get excellent results and the correct level of resource use without installing third-party proxy and cache modules. So let’s start,<br /><br /><br />Apache & PHP<br /><br />In the first stage we run the Easy Apache and selected the following:<br /><br /> Apache Version 2.4+<br /><br /> PHP Version 5.6+<br /><br /> In step 5 “Exhaustive Options List” select<br /><br />– Deflate<br /><br />– Expires<br /><br />– MPM Worker<br /><br />After Easy Apache finished go to your WHM » Service Configuration » Apache Configuration » “Global Configuration” and set the values by the level of resources available on your server.<br /><br /> Apache Directive (From 2GB memory or less and to 12GB+ memory) <br />
<a name='more'></a><br /><br />
<blockquote class="tr_bq">
StartServers 4 8 16 <br /> MinSpareServers 4 8 16 <br /> MaxSpareServers 8 16 32 <br /> ServerLimit 128 256 512 <br /> MaxRequestWorkers 150 250 500 <br /> MaxConnectionsPerChild 1000 2500 5000 <br /> Keep-Alive On On On<br /> Keep-Alive Timeout 1 1 1<br /> Max Keep-Alive Requests 30 30 30<br /> Timeout 60 60 60</blockquote>
<br />Now go to WHM » Service Configuration » Apache Configuration » Include Editor » “Pre VirtualHost Include” and allow users minimal cache and data compression to allow the server to work less for the same things by pasting the code below into the text field.<br /><br />
<blockquote>
# Cache Control Settings for one hour cache<br /> <FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"><br /> Header set Cache-Control "max-age=3600, public"<br /> </FilesMatch><br /><br /> <FilesMatch ".(xml|txt)$"><br /> Header set Cache-Control "max-age=3600, public, must-revalidate"<br /> </FilesMatch><br /><br /> <FilesMatch ".(html|htm)$"><br /> Header set Cache-Control "max-age=3600, must-revalidate"<br /> </FilesMatch><br /><br /> # Mod Deflate performs data compression<br /> <IfModule mod_deflate.c><br /> <FilesMatch ".(js|css|html|php|xml|jpg|png|gif)$"><br /> SetOutputFilter DEFLATE<br /> BrowserMatch ^Mozilla/4 gzip-only-text/html<br /> BrowserMatch ^Mozilla/4.0[678] no-gzip<br /> BrowserMatch bMSIE no-gzip<br /> </FilesMatch><br /> </IfModule></blockquote>
<br />Go to WHM » Service Configuration » “PHP Configuration Editor” and set the parameters according to your needs:<br /><br />– memory_limit<br /><br />– max_execution_time<br /><br />– max_input_time<br /><br /><br />MySQL<br /><br />For MySQL you need to update the configuration file that usually in /etc/my.cnf<br /><br />Best config base on 2 core & 4GB memory MySQL 5.6 \ MariaDB 10:<br /><br />
<blockquote class="tr_bq">
[mysqld]<br /> local-infile = 0<br /> max_connections = 250<br /> key_buffer = 64M<br /> myisam_sort_buffer_size = 64M<br /> join_buffer_size = 1M<br /> read_buffer_size = 1M<br /> sort_buffer_size = 2M<br /> max_heap_table_size = 16M<br /> table_cache = 5000<br /> thread_cache_size = 286<br /> interactive_timeout = 25<br /> wait_timeout = 7000<br /> connect_timeout = 15<br /> max_allowed_packet = 16M<br /> max_connect_errors = 10<br /> query_cache_limit = 2M<br /> query_cache_size = 32M<br /> query_cache_type = 1<br /> tmp_table_size = 16M<br /> open_files_limit=25280<br /><br /> [mysqld_safe]<br /><br /> [mysqldump]<br /> quick<br /> max_allowed_packet = 16M<br /> [myisamchk]<br /> key_buffer = 64M<br /> sort_buffer = 64M<br /> read_buffer = 16M<br /> write_buffer = 16M<br /> [mysqlhotcopy]<br /> interactive-timeout</blockquote>
<br />Best config base on 8 core & 16GB+ memory (Shared server) MySQL 5.6 \ MariaDB 10:<br /><br /> [mysqld]<br /> local-infile=0<br /> max_connections = 600<br /> max_user_connections=1000<br /> key_buffer_size = 512M<br /> myisam_sort_buffer_size = 64M<br /> read_buffer_size = 1M<br /> table_open_cache = 5000<br /> thread_cache_size = 384<br /> wait_timeout = 20<br /> connect_timeout = 10<br /> tmp_table_size = 256M<br /> max_heap_table_size = 128M<br /> max_allowed_packet = 64M<br /> net_buffer_length = 16384<br /> max_connect_errors = 10<br /> concurrent_insert = 2<br /> read_rnd_buffer_size = 786432<br /> bulk_insert_buffer_size = 8M<br /> query_cache_limit = 5M<br /> query_cache_size = 128M<br /> query_cache_type = 1<br /> query_prealloc_size = 262144<br /> query_alloc_block_size = 65535<br /> transaction_alloc_block_size = 8192<br /> transaction_prealloc_size = 4096<br /> max_write_lock_count = 8<br /> slow_query_log<br /> log-error<br /> external-locking=FALSE<br /> open_files_limit=50000<br /><br /> [mysqld_safe]<br /><br /> [mysqldump]<br /> quick<br /> max_allowed_packet = 16M<br /><br /> [isamchk]<br /> key_buffer = 384M<br /> sort_buffer = 384M<br /> read_buffer = 256M<br /> write_buffer = 256M<br /><br /> [myisamchk]<br /> key_buffer = 384M<br /> sort_buffer = 384M<br /> read_buffer = 256M<br /> write_buffer = 256M<br /><br /> sort_buffer_size = 1M<br /> join_buffer_size = 1M<br /> thread_stack = 192Kdatlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-61437639685059230982018-12-05T15:03:00.001-08:002018-12-05T15:03:15.008-08:00Command to activate VG on LVMWhen you create a volume group, by default, it is activated. Sometimes you may need to activate it manually to make the kernel aware of volume groups.<br /><br />To activate,<br /><br />
<blockquote class="tr_bq">
# vgchange -ay my_vg_name</blockquote>
<br />To De-activate,<br /><br />
<blockquote class="tr_bq">
# vgchnage -an my_vg_name</blockquote>
<br />A command to activate the VG in a cluster?<br /><br />To activate exclusively on one node,<br />
<a name='more'></a><br /><br />
<blockquote class="tr_bq">
# vgchange -aey my_vg_name</blockquote>
<br />To deactivate exclusively on one node,<br /><br />
<blockquote class="tr_bq">
# vgchange -aen my_vg_name</blockquote>
<br />To activate only on the local node,<br /><br />
<blockquote class="tr_bq">
# vgchange -aly my_vg_name</blockquote>
<br />To deactivate only on the local node,<br /><br />
<blockquote class="tr_bq">
# vgchange -aln my_vg_name</blockquote>
datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-90286419453087082752018-12-05T15:01:00.001-08:002018-12-05T15:01:13.703-08:00cPanel EasyApache 4 Installing Redis and Redis PHP extensionInstalling the Redis daemon:<br /><br />for CentOS 6/RHEL 6<br /><br />
<blockquote class="tr_bq">
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm<br /> rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm<br /> yum -y install redis --enablerepo=remi --disableplugin=priorities<br /> chkconfig redis on<br /> service redis start</blockquote>
<br />for CentOS 7/RHEL 7<br /><br />
<blockquote class="tr_bq">
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm<br /> rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm<br /> yum -y install redis --enablerepo=remi --disableplugin=priorities<br /> systemctl enable redis<br /> systemctl start redis</blockquote>
<br />
<a name='more'></a><br />Installing the Redis PHP extension for all available versions of PHP.<br />Copy and paste the entire block into SSH, don't do line by line.<br /><br /><br />
<blockquote class="tr_bq">
for phpver in $(ls -1 /opt/cpanel/ |grep ea-php | sed 's/ea-php//g') ; do<br /> cd ~<br /> wget -O redis.tgz https://pecl.php.net/get/redis<br /> tar -xvf redis.tgz<br /> cd ~/redis* || exit<br /> /opt/cpanel/ea-php"$phpver"/root/usr/bin/phpize<br /> ./configure --with-php-config=/opt/cpanel/ea-php"$phpver"/root/usr/bin/php-config<br /> make clean && make install<br /> echo 'extension=redis.so' > /opt/cpanel/ea-php"$phpver"/root/etc/php.d/redis.ini<br /> rm -rf ~/redis*<br /> done<br /><br /> /scripts/restartsrv_httpd<br /> /scripts/restartsrv_apache_php_fpm</blockquote>
<br />All done! Check to make sure the PHP extension is loaded in each version of PHP:<br />Copy and paste the entire block into SSH, don't do line by line.<br /><br />
<blockquote class="tr_bq">
<blockquote class="tr_bq">
for phpver in $(ls -1 /opt/cpanel/ |grep php | sed 's/ea-php//g') ; do<br /> echo "PHP $phpver" ; /opt/cpanel/ea-php$phpver/root/usr/bin/php -i |grep "Redis Support"<br /> done</blockquote>
</blockquote>
<br />Output should be:<br /><br />
<blockquote class="tr_bq">
PHP 55<br /> Redis Support => enabled<br /> PHP 56<br /> Redis Support => enabled<br /> PHP 70<br /> Redis Support => enabled<br /> PHP 71<br /> Redis Support => enabled</blockquote>
datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-76222939077061864962018-12-05T14:58:00.001-08:002018-12-05T14:58:28.961-08:00Resetting email account password from Command line in cPanel1) Login to the server as root via SSH<br /><br />2) Run the command “openssl” and you will see this:<br /><br /> test@test [~]# openssl<br /> OpenSSL><br /><br />3) Now in the OpenSSL prompt give the command : passwd -1 “your_new_email_password”<br /><br /> test@test [~]# openssl<br /> OpenSSL> passwd -1 “test@123”<br /> $1$m4pq941w/j$1KYI5VwHl8C6h9H6ScTFNWy/<br /> OpenSSL> quit<br /><br />Please note the option in command: passwd -1 “test@123”. It is not alphabet “-l”. It is numeric “-1”.<br />You will get the MD5 encrypted format for your password. Copy it somewhere.<br />
<a name='more'></a><br />4) Now you need to go to cpanel account’s home directory and then into etc folder.<br /><br /> test@test [~]# cd /home/test/etc/test.com<br /> test@test [/home/test/etc/test.com]#<br /><br />5) There you will be seeing some files : passwd, passwd,v , quota, quota,v , shadow, shadow,v .<br />Here the file we should consider is shadow and shadow,v.<br /><br />6) If you check out shadow folder, you will see<br /><br /> test@test [/home/test/etc/test.com]# cat shadow<br /> test:$6$itlQRsdN/bGoiCB/n/$53X3P/wy.lsS6uds4u7vporiAqdKBnfsF8Zx8b6MXs6/oxM0inzns3lsDfHdXNygq3pdPOFR57ryWHk63A7JJr2r61:15673::::::<br /><br />Please note that the dark black colored part is the password part. You need to replace it with the MD5 format of your new password which you copied from OpenSSL prompt earlier.<br /><br /> test:$1$m4pq941w/j$1KYI5VwHl8C6h9H6ScTFNWy/:16673::::::<br /><br />Save and close the file.<br /><br />If shadow,v file is present then replace the encrypted part same as above. If a file is not present then try login to webmail it will work.<br />datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-86008489689231542802018-12-05T14:57:00.000-08:002018-12-05T14:57:04.163-08:00How to upgrade ubuntu 16.04 to ubuntu 18.04Check Ubuntu version before upgrading.<br /><br /> lsb_release -a<br /><br />First, we have to run an update<br /><br /> sudo apt update<br /><br />Then run upgrade command<br /><br /> sudo apt upgrade<br /><br />After that dist-upgrade<br /><br /> sudo apt dist-upgrade<br /><br />Then update core manager<br /><br /> sudo apt install update-manager-core<br />
<a name='more'></a><br />Then edit below file <br /><br /> sudo vim /etc/update-manager/release-upgrades<br /><br />At the end of the file set <br /><br /> Prompt-lts<br /><br />Then save this file<br /><br />Then do a release upgrade<br /><br /> sudo do-release-upgrade -d<br /><br />Once done, Then restart the machine and check again.<br />datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-3009116284217494522018-12-05T14:54:00.004-08:002018-12-05T14:54:52.517-08:00Kill restore process in new cpanel<br />In new cpanel/WHM when we try to kill restore process it is still showing in WHM >> restore full backup. Below are the steps to remove that process from WHM.<br /><br />You can manually mark the transfer as completed using the following instructions:<br /><br />Ensure the transfer is no longer running by clicking on the “View” option under "Sessions in Progress" for this transfer. In the new window, there will be a line that looks like this:<br /><br /> You may close this window and view the transfer on the command line: /usr/local/cpanel/bin/view_transfer 1071601843quick20141013154952IAZhRro<br /><br />Access your server via SSH and run that command (the transfer name will be different on your server):<br /><br /> /usr/local/cpanel/bin/view_transfer 1071601843quick20141013154952IAZhRro<br />
<a name='more'></a><br />As an example, you might see output like this:<br /><br /> Transfer running with pid: paused<br /> [795 ][MASTER ]: Start Session<br /> [795 ][MASTER ]: Version: 1.9<br /><br />You will note that the master PID for this transfer is xxx. If the process still exists, and the transfer has failed, then you can kill that process:<br /><br /> kill -9 xxx<br /><br />The next step requires you to change the entry for this transfer in the whmxfer.sessions table in MySQL. Find the entry with the session ID for your migration. In the example we have been using, it's ' 1071601843quick20141013154952IAZhRro .' It will look like this:<br /><br /> mysql -e "select * from whmxfer.sessions where sessionid='1071601843quick20141013152137YIVT7Ze'"<br /> +--------------------------------------+--------------+-------+---------+-----------------------+-------------+-------+---------------------+---------+<br /> | sessionid | initiator | pid | version | target_host | source_host | state | starttime | endtime |<br /> +--------------------------------------+--------------+-------+---------+-----------------------+-------------+-------+---------------------+---------+<br /> | 1071601843quick20141013152137YIVT7Ze | quickrestore | 21295 | 1.9 | vps1.insurancedxb.com | localhost | 50 | 2014-10-13 08:21:37 | NULL |<br /> +--------------------------------------+--------------+-------+---------+-----------------------+-------------+-------+---------------------+---------+<br /><br />You will need to change the 'state' field to 100, and change the 'endtime' field from NULL to a time after the 'starttime' field:<br /><br /> mysql -e "update whmxfer.sessions set state='100', endtime='2014-10-14 09:37:52' where sessionid='1071601843quick20141013152137YIVT7Ze'"<br /><br />If you check it again then you will notice that process ended.<br /><br /> +--------------------------------------+--------------+-------+---------+-----------------------+-------------+-------+---------------------+---------------------+<br /> | sessionid | initiator | pid | version | target_host | source_host | state | starttime | endtime |<br /> +--------------------------------------+--------------+-------+---------+-----------------------+-------------+-------+---------------------+---------------------+<br /> | 1071601843quick20141013152137YIVT7Ze | quickrestore | 21295 | 1.9 | vps1.insurancedxb.com | localhost | 100 | 2014-10-13 08:21:37 | 2014-10-14 09:37:52 |<br /> +--------------------------------------+--------------+-------+---------+-----------------------+-------------+-------+---------------------+---------------------+<br /><br />The transfer should then no longer appear under "Sessions in Progress."<br /><br />You can reconfirm the same by login into WHM.<br />datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-88369282496881795672018-12-05T14:52:00.000-08:002018-12-05T14:52:45.352-08:00dd command to migrate VPS on linux platformFirst create new vps with same configuration on another node. It doesn't matter new vps is having os or not or you can choose any OS.<br /><br />Once same configuration VPS setup done then use below command to migrate VPS.<br /><br /> dd if=/dev/guestos/kvm2351_img | ssh 10.10.10.10 "dd of=/dev/guestos/kvm2520_img"<br />
<a name='more'></a><br />Once migration is completed then try starting VPS on new node.<br />datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0tag:blogger.com,1999:blog-6563619442555867219.post-68328983183303591772018-07-29T07:27:00.003-07:002018-07-29T07:27:47.789-07:00Changing Server Hostname<div class="kb-article-content">
To change your hostname, enter the following command as root:<br /><br /><blockquote class="tr_bq">
$ hostname servername.yourdomain.com</blockquote>
<br />If you are using cPanel, you will need to resync your license with the cPanel license server. To do this, use the following command:<br /><br /><blockquote class="tr_bq">
$ /usr/local/cpanel/cpkeyclt</blockquote>
</div>
datlinuxhttp://www.blogger.com/profile/18071973511371523264noreply@blogger.com0