{"id":283,"date":"2018-03-10T15:37:20","date_gmt":"2018-03-10T07:37:20","guid":{"rendered":"https:\/\/www.techcoil.com\/blog\/?p=283"},"modified":"2019-01-15T08:52:31","modified_gmt":"2019-01-15T00:52:31","slug":"how-to-setup-codiad-web-ide-on-your-raspberry-pi-3-with-raspbian-stretch-lite-nginx-and-php","status":"publish","type":"post","link":"https:\/\/www.techcoil.com\/blog\/how-to-setup-codiad-web-ide-on-your-raspberry-pi-3-with-raspbian-stretch-lite-nginx-and-php\/","title":{"rendered":"How to setup Codiad Web IDE on your Raspberry Pi 3 with Raspbian Stretch Lite, Nginx and PHP"},"content":{"rendered":"<p>A Web IDE server allows you to code wherever you are and whenever you want from any device through a web browser. A <a href=\"https:\/\/www.amazon.com\/gp\/product\/B01CD5VC92\/ref=as_li_ss_tl?smid=A30ZYR2W3VAJ0A&psc=1&linkCode=ll1&tag=clivsperswebs-20&linkId=ea3d80d91754b72a5ed6c2cfeedf2ddb\" rel=\"noopener\" target=\"_blank\">Raspberry Pi 3 board<\/a> is a good <a href=\"https:\/\/www.techcoil.com\/shop\/for\/gifts-for-programmers\" rel=\"noopener\" target=\"_blank\">gift for programmers<\/a> and if you happen to receive one or bought one and do not know what to do with it, you may want to setup <a href=\"http:\/\/How to setup Codiad Web IDE on your Raspberry Pi 3 with Raspbian Stretch Lite, Nginx and PHP\" rel=\"noopener\" target=\"_blank\">Codiad Web IDE<\/a> on it to help you code while you are on the move. <\/p>\n<p>Read on to find out how to setup Codiad Web IDE on your Raspberry Pi 3 with Raspbian Stretch Lite, Nginx and PHP as the <a href=\"https:\/\/www.techcoil.com\/lemp\/\" rel=\"noopener\" target=\"_blank\">LEMP stack<\/a>.<\/p>\n<h2>Recommended hardware list to build your Raspberry Pi 3 Codiad Web IDE<\/h2>\n<p>If you do not have the hardware to build your Raspberry Pi 3 Codiad Web IDE, you may want to consider getting the following hardware:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.amazon.com\/gp\/product\/B01CD5VC92\/ref=as_li_ss_tl?smid=A30ZYR2W3VAJ0A&psc=1&linkCode=ll1&tag=clivsperswebs-20&linkId=ea3d80d91754b72a5ed6c2cfeedf2ddb\" rel=\"noopener\" target=\"_blank\">Raspberry Pi 3 board<\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/Sandisk-Ultra-Micro-UHS-I-Adapter\/dp\/B073JYVKNX\/ref=as_li_ss_tl?s=electronics&ie=UTF8&qid=1519546458&sr=1-1-fkmr0&keywords=Sandisk+Ultra+64GB+Micro+SDHC+UHS-I+Card+with+Adapter+-+98MB\/s+U1+A1&linkCode=ll1&tag=clivsperswebs-20&linkId=63030733e82634a740772cf7f154c197\" rel=\"noopener\" target=\"_blank\">Sandisk Ultra 64GB Micro SDXC UHS-I Card with Adapter - 100MB\/s U1 A1<\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/dp\/B01F1PSFY6\/ref=as_li_ss_tl?ie=UTF8&linkCode=ll1&tag=clivsperswebs-20&linkId=ec2909827d5738a47e410c38bc8d1225\" rel=\"noopener\" target=\"_blank\">Official case for Raspberry Pi 3 Model B (Black and Grey)<\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/CanaKit-Raspberry-Supply-Adapter-Charger\/dp\/B00MARDJZ4\/ref=as_li_ss_tl?s=electronics&ie=UTF8&qid=1520423018&sr=1-3&keywords=official+raspberry+pi+power+supply&linkCode=ll1&tag=clivsperswebs-20&linkId=bb792b98d2438c81612a00139832888b\" rel=\"noopener\" target=\"_blank\">CanaKit 5V 2.5A Raspberry Pi 3 Power Supply \/ Adapter \/ Charger<\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/gp\/product\/B00N2VISLW\/ref=as_li_ss_tl?imprToken=2cLG3j0M.aqSnBsco3eR2g&slotNum=4&ie=UTF8&linkCode=ll1&tag=clivsperswebs-20&linkId=835a8de776a4293573a0a45285e5d52b\" rel=\"noopener\" target=\"_blank\">AmazonBasics RJ45 Cat-6 Ethernet Patch Cable - 3 Feet (0.9 Meters)<\/a><\/li>\n<\/ul>\n<h2>Setting up Raspbian Stretch Lite with SSH server enabled on your microSD card<\/h2>\n<p>Once you had gathered all the necessary hardware, proceed to <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-setup-raspbian-stretch-lite-with-ssh-server-enabled-on-your-microsd-card\/\" rel=\"noopener\" target=\"_blank\">setup Raspbian Stretch Lite with SSH server enabled on your microSD card<\/a>. Doing so will allow you to SSH into your Raspbian Stretch Lite to perform further configurations in this post. <\/p>\n<h2>Assembling the hardware for the Raspberry Pi 3<\/h2>\n<p>Once you had prepared the microSD card with Raspbian Stretch Lite as the operating system, remove the microSD card from your SD card reader and insert it to the microSD card slot on the Raspberry Pi 3 board. After that, proceed to <a href=\"\/blog\/how-to-assemble-the-raspberry-pi-3-board-with-the-raspberry-pi-official-case\/\" target=\"_blank\">assemble the Raspberry Pi 3 board to the Official Raspberry Pi case<\/a>.<\/p>\n<h2>Starting the Raspbian Stretch Lite operating system<\/h2>\n<p>After you had assembled the Raspberry Pi 3 board with the Official Raspberry Pi case, connect one end of the RJ45 cable to the RJ45 port on the Raspberry Pi 3 board and the other end of the cable to one of the switch port of your <a href=\"https:\/\/www.amazon.com\/s\/ref=as_li_ss_tl?url=search-alias=aps&field-keywords=home+router&linkCode=ll2&tag=clivsperswebs-20&linkId=dd988f9e10e1a419b9d518690e9c8cd8\" target=\"_blank\">home router<\/a>. After that, connect the micro USB power supply to the Raspberry Pi 3 board and a wall socket. Turn on the power socket to supply power to the Raspberry Pi 3 board.<\/p>\n<h2>Changing default password, Locale and Timezone of your Raspbian Stretch Lite<\/h2>\n<p>There are a few configurations that you should perform on the first run of your Raspbian Stretch Lite. Proceed on to <a href=\"https:\/\/www.techcoil.com\/blog\/set-of-configurations-to-perform-on-the-first-run-of-your-raspbian-stretch-lite\/\" rel=\"noopener\" target=\"_blank\">change the default password, Locale and Timezone of your Raspbian Stretch Lite<\/a>.  <\/p>\n<h2>Installing Nginx on Raspbian Stretch Lite<\/h2>\n<p>Nginx runs well on Raspberry Pi 3 and can serve as a <a href=\"https:\/\/www.techcoil.com\/blog\/the-reverse-proxy-server\/\" rel=\"noopener\" target=\"_blank\">reverse proxy server<\/a> for other upstream applications written in other programming languages. By putting Nginx in front of Codiad, we are giving our Raspberry Pi 3 room for deploying other applications in the future.<\/p>\n<p>To install Nginx on Raspbian Stretch Lite, run the following commands:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get update\r\nsudo apt-get install nginx -y\r\n<\/pre>\n<p>After the installation completes, you can run the following command to verify that Nginx is installed successfully:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl status nginx.service\r\n<\/pre>\n<p>Nginx is installed successfully if you see output similar to the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\u25cf nginx.service - A high performance web server and a reverse proxy server\r\n   Loaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; vendor preset: enabled)\r\n   Active: active (running) since Wed 2018-03-07 23:17:15 +08; 4min 0s ago\r\n     Docs: man:nginx(8)\r\n  Process: 15094 ExecStart=\/usr\/sbin\/nginx -g daemon on; master_process on; (code=exited, status=0\/SUCCESS)\r\n  Process: 15091 ExecStartPre=\/usr\/sbin\/nginx -t -q -g daemon on; master_process on; (code=exited, status=0\/SU\r\n Main PID: 15095 (nginx)\r\n   CGroup: \/system.slice\/nginx.service\r\n           \u251c\u250015095 nginx: master process \/usr\/sbin\/nginx -g daemon on; master_process on;\r\n           \u251c\u250015096 nginx: worker process\r\n           \u251c\u250015097 nginx: worker process\r\n           \u251c\u250015098 nginx: worker process\r\n           \u2514\u250015099 nginx: worker process\r\n\r\nMar 07 23:17:15 raspberrypi systemd&#x5B;1]: Starting A high performance web server and a reverse proxy server...\r\nMar 07 23:17:15 raspberrypi systemd&#x5B;1]: Started A high performance web server and a reverse proxy server.\r\n<\/pre>\n<h2>Installing PHP 7 on Raspbian Stretch Lite<\/h2>\n<p>Since Codiad Web IDE is written in PHP, the next item on the list is to install the PHP 7 binary and the <a href=\"http:\/\/php.net\/manual\/en\/book.fpm.php\" rel=\"noopener\" target=\"_blank\">FastCGI Process Manager<\/a>. Run the following command to do so:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install php7.0 php7.0-fpm -y\r\n<\/pre>\n<p>Once the command completes, you can check if PHP 7 FastCGI Process Manager is installed successfully with the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl status php7.0-fpm.service\r\n<\/pre>\n<p>You should see output similar to the following if PHP 7 FastCGI Process Manager is installed successfully:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\u25cf php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager\r\n   Loaded: loaded (\/lib\/systemd\/system\/php7.0-fpm.service; enabled; vendor preset: enabled)\r\n   Active: active (running) since Wed 2018-03-07 23:24:31 +08; 21min ago\r\n     Docs: man:php-fpm7.0(8)\r\n Main PID: 21314 (php-fpm7.0)\r\n   Status: &quot;Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req\/sec&quot;\r\n   CGroup: \/system.slice\/php7.0-fpm.service\r\n           \u251c\u250021314 php-fpm: master process (\/etc\/php\/7.0\/fpm\/php-fpm.conf)\r\n           \u251c\u250021315 php-fpm: pool www\r\n           \u2514\u250021316 php-fpm: pool www\r\n\r\nMar 07 23:24:31 raspberrypi systemd&#x5B;1]: Starting The PHP 7.0 FastCGI Process Manager...\r\nMar 07 23:24:31 raspberrypi systemd&#x5B;1]: Started The PHP 7.0 FastCGI Process Manager.\r\n<\/pre>\n<h2>Installing the PHP modules that is needed by Codiad Web IDE<\/h2>\n<p>The Codiad Web IDE marketplace requires the mbstring, zip and openssl PHP libraries in order to function properly. Since mbstring and zip are not packaged with the PHP binary that we had installed earlier, we need to install them by running the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install php-zip php-mbstring -y\r\n<\/pre>\n<h2>Downloading a copy of the Codiad Web IDE<\/h2>\n<p>At this writing, the latest stable release for Codiad Web IDE is v.2.8.4. Run the following commands to download the source code for Codiad v.2.8.4:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncd \/var\/www\r\nsudo wget https:\/\/github.com\/Codiad\/Codiad\/archive\/v.2.8.4.tar.gz\r\nsudo tar -xvzf v.2.8.4.tar.gz\r\nsudo rm v.2.8.4.tar.gz\r\n<\/pre>\n<p>You will get a copy of the Codiad Web IDE source code at <code>\/var\/www\/Codiad-v.2.8.4<\/code> after the commands had completed. <\/p>\n<h2>Changing the owner of the \/var\/www\/Codiad-v.2.8.4 directory to www-data<\/h2>\n<p>Once you had downloaded a copy of Codiad Web IDE, the next step is to change the owner of the source code directory to <code>www-data<\/code>. Run the following command to do so:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo chown -R www-data:www-data \/var\/www\/Codiad-v.2.8.4\r\n<\/pre>\n<h2>Configure Nginx to serve Codiad Web IDE via the private IP address<\/h2>\n<p>After you had changed the owner of the source code directory, the next step is to <a href=\"https:\/\/www.techcoil.com\/blog\/configuring-nginx-for-php-web-applications\/\" rel=\"noopener\" target=\"_blank\">configure Nginx to serve the PHP web application<\/a>, Codiad Web IDE, via the private IP address of your Raspberry Pi. This is to facilitate you in running the install script and creating the first user for your Codiad Web IDE.<\/p>\n<p>Suppose that you Raspberry Pi had gotten 192.168.1.109 as the private address. To configure Nginx to serve the IDE via the private IP address, use <code>nano<\/code> to create a file at <code>\/etc\/nginx\/sites-enabled\/192.168.1.109.conf<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo nano\r\n<\/pre>\n<p>And create the following content inside the file:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nserver {\r\n\r\n    listen 80;\r\n    server_name 192.168.1.109;\r\n\r\n    root \/var\/www\/Codiad-v.2.8.4;\r\n    index index.php;\r\n\r\n    location \/ {\r\n        try_files $uri $uri\/ \/index.php?$args;\r\n    }\r\n \r\n    location ~ \\.php$ {\r\n        include fastcgi.conf;\r\n        fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\r\n        fastcgi_buffers 16 16k;\r\n        fastcgi_buffer_size 32k;\r\n    }\r\n\r\n}\r\n<\/pre>\n<p>After you had saved the changes to the file, restart Nginx by running the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl restart nginx.service\r\n<\/pre>\n<h2>Performing initial setup of your Codiad Web IDE<\/h2>\n<p>Once you had done so, put in the private IP address of your Raspberry Pi into the location bar of the browser in your work computer (for example, http:\/\/192.168.1.109). <\/p>\n<p>You should see the following screen that prompts you to perform the initial setup for your Codiad Web IDE:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/codiad-v2.8.4-initial-setup-screen.gif\" alt=\"Codiad v2.8.4 initial setup screen\" \/><\/p>\n<p>This screen allows us to create our first Codiad IDE user with a first project to work on. The directory that you provide in this screen had to be owned by the <code>www-data<\/code> user; if not, Codiad Web IDE will not be able to use that directory to work on the source codes within that directory.<\/p>\n<p>After filling in the fields and clicking the install button, you will be prompted to login with the user credentials that you had supplied in the initial setup screen:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/codiad-v2.8.4-login-screen.gif\" alt=\"Codiad v2.8.4 login screen\"\/><\/p>\n<p>After you had logged in, you should see the editor screen to work on the source codes that is contained within the directory that you had supplied in the initial setup screen:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/codiad-v2.8.4-editor-screen-for-first-project.gif\" alt=\"Codiad v2.8.4 editor screen for first project\"\/><\/p>\n<h2>Enabling outside access to your Codiad Web IDE via your own domain name through HTTP<\/h2>\n<p>Once you had performed the initial setup for your Codiad Web IDE, you can continue to enable access to it from your home network. If you do not switch off your home router and Internet modem, chances are the public IP address that your router had retrieved from your ISP will not change. <\/p>\n<p>For the rest of this guide, let's assume that:<\/p>\n<ul>\n<li>the public IP address of our router will not change.<\/li>\n<li>you have a domain name at your disposal.<\/li>\n<li>you had configured the domain name server to map the domain name to the public IP address of your router.<\/li>\n<\/ul>\n<p>If your public IP address changes frequently or you do not have a domain name, you will need to use the service of a Dynamic DNS service. For example, you can <a href=\"https:\/\/namecheap.pxf.io\/c\/1303251\/386170\/5618?u=https%3A%2F%2Fwww.namecheap.com%2Fdomains%2Fdomain-name-search.aspx\" rel=\"noopener\" target=\"_blank\">buy a Namecheap domain<\/a> and <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-get-your-raspberry-pi-3-to-use-namecheap-dynamic-dns-to-update-your-domain-when-your-homes-public-ip-address-changes\/\" rel=\"noopener\" target=\"_blank\">get your Raspberry Pi 3 to use Namecheap dynamic DNS to update your domain when your home\u2019s public IP address changes<\/a>.<\/p>\n<h3>Configuring Nginx to serve Codiad Web IDE through HTTP<\/h3>\n<p>Let's assume that you are using <strong>ide.anexistingdomain.com<\/strong> as the domain name to access your Codiad Web IDE from outside your home. <\/p>\n<p>To configure Nginx to serve Codiad Web IDE through HTTP requests directed at <strong>ide.anexistingdomain.com<\/strong>, we first rename <code>\/etc\/nginx\/sites-enabled\/192.168.1.109.conf<\/code> to <code>\/etc\/nginx\/sites-enabled\/ide.anexistingdomain.com.conf<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo mv \/etc\/nginx\/sites-enabled\/192.168.1.109.conf \/etc\/nginx\/sites-enabled\/ide.anexistingdomain.com.conf\r\n<\/pre>\n<p>Once we had renamed the configuration file, we then use nano to open up the <code>\/etc\/nginx\/sites-enabled\/ide.anexistingdomain.com.conf<\/code> file:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo nano \/etc\/nginx\/sites-enabled\/ide.anexistingdomain.com.conf\r\n<\/pre>\n<p>And change the <code>server_name<\/code> from <code>192.168.1.109<\/code> to <strong>ide.anexistingdomain.com<\/strong>.<\/p>\n<h2>Enabling outside access to your Codiad Web IDE via your own domain name through HTTPS<\/h2>\n<p>The Nginx configurations that we had discussed so far will allow you to access your Codiad Web IDE via your own domain name through HTTP. However, communication between Nginx and web clients is not encrypted. Since <a href=\"https:\/\/letsencrypt.org\/\" rel=\"noopener\" target=\"_blank\">Let's Encrypt<\/a> give us free browser-trusted SSL certificates, you may want to consider securing access to your Codiad Web IDE through HTTPS.<\/p>\n<h3>Installing Certbot on Raspbian Stretch Lite<\/h3>\n<p>The issuance of Let\u2019s Encrypt certificates is automated by software participating in the <a href=\"https:\/\/ietf-wg-acme.github.io\/acme\/\" rel=\"noopener\" target=\"_blank\">ACME protocol<\/a>. Certbot is one such client that can help us get free browser-trusted SSL\/TLS certificates from Let's Encrypt. Proceed to <a href=\"https:\/\/www.techcoil.com\/blog\/installing-certbot-on-raspbian-stretch-lite-for-obtaining-lets-encrypts-browser-trusted-certificates\/\" rel=\"noopener\" target=\"_blank\">install Certbot on your Raspbian Stretch Lite operating system<\/a>.<\/p>\n<h3>Configuring Nginx to demonstrate control over your domain<\/h3>\n<p>After you had installed Certbot on your Raspbian Stretch Lite on your Raspbian Stretch Lite operating system, the next step is to configure Nginx to take part in the ACME protocol to demonstrate control over your domain. <\/p>\n<p>One of Let's Encrypt servers will validate that you are running an ACME client on your Raspberry Pi 3 during the generation of the SSL certificate. The Let's Encrypt server will do so by accessing a file that the ACME client had shared with it through the <code>\/.well-known<\/code> uri path.<\/p>\n<p>Hence, you will need to add in the following <code>location<\/code> block in the Nginx configuration that we had mentioned earlier:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nlocation ~ \/.well-known {\r\n    allow all;\r\n}\r\n<\/pre>\n<p>The addition of this block will result in <code>\/etc\/nginx\/sites-enabled\/ide.anexistingdomain.com.conf<\/code> to contain the following content:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nserver {\r\n \r\n    listen 80;\r\n    server_name ide.anexistingdomain.com;\r\n \r\n    root \/var\/www\/Codiad-v.2.8.4;\r\n    index index.php;\r\n\r\n    location ~ \/.well-known {\r\n        allow all;\r\n    }\r\n\r\n    location \/ {\r\n        try_files $uri $uri\/ \/index.php?$args;\r\n    }\r\n  \r\n    location ~ \\.php$ {\r\n        include fastcgi.conf;\r\n        fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\r\n        fastcgi_buffers 16 16k;\r\n        fastcgi_buffer_size 32k;\r\n    }\r\n \r\n}\r\n<\/pre>\n<p>Once you had made the changes to <code>\/etc\/nginx\/sites-enabled\/ide.anexistingdomain.com.conf<\/code>, restart Nginx with the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl restart nginx.service\r\n<\/pre>\n<h3>Using Certbot to get Let's Encrypt to issue the browser-trusted SSL certificate for our domain<\/h3>\n<p>Once you had allowed access to the <code>\/.well-known<\/code> url, run the following command to generate the SSL certificate for your Codiad Web IDE:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo certbot certonly -a webroot --webroot-path=\/var\/www\/Codiad-v.2.8.4 -d ide.anexistingdomain.com\r\n<\/pre>\n<p>When the command runs for the very first time on your machine, it will ask for an email address to notify when the SSL certificate is going to expire and an agreement to Let's Encrypt Terms of Service.<\/p>\n<p>Once you had given the necessary responses, CertBot will create the SSL artefacts inside the <code>\/etc\/letsencrypt\/live\/ide.anexistingdomain.com<\/code> directory. Inside <code>\/etc\/letsencrypt\/live\/ide.anexistingdomain.com<\/code>, you will find <code>cert.pem<\/code>, <code>chain.pem<\/code>, <code>fullchain.pem<\/code> and <code>privkey.pem<\/code>. The files inside <code>\/etc\/letsencrypt\/live\/ide.anexistingdomain.com<\/code> directory are symbolic links for facilitating certificate renewal without changing your server side configurations.<\/p>\n<h3>Generating a strong Diffie-Hellman group<\/h3>\n<p>The next ingredient for our Nginx to serve HTTPS traffic is a strong Diffie-Hellman group. Run the following command to precompute a strong Diffie-Hellman group for your Codiad Web IDE to use for exchanging cryptographic keys with its clients:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo openssl dhparam -out \/etc\/ssl\/certs\/dhparam.pem 2048\r\n<\/pre>\n<h3>Configuring Nginx to serve Codiad Web IDE over HTTPS<\/h3>\n<p>Next up, proceed to configure Nginx to serve Codiad Web IDE over HTTPS. To do so, change the contents of <code>\/etc\/nginx\/sites-enabled\/ide.anexistingdomain.com.conf<\/code> to the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nserver {\r\n        listen   80;\r\n        server_name ide.anexistingdomain.com;\r\n        return 301 https:\/\/$host$request_uri;\r\n}\r\n \r\n# For ssl\r\nserver {\r\n        ssl on;\r\n \r\n        ssl_certificate \/etc\/letsencrypt\/live\/ide.anexistingdomain.com\/fullchain.pem;\r\n        ssl_certificate_key \/etc\/letsencrypt\/live\/ide.anexistingdomain.com\/privkey.pem;\r\n        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\r\n        ssl_prefer_server_ciphers on;\r\n        ssl_dhparam \/etc\/ssl\/certs\/dhparam.pem;\r\n        ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';\r\n        ssl_session_timeout 1d;\r\n        ssl_session_cache shared:SSL:50m;\r\n        ssl_stapling on;\r\n        ssl_stapling_verify on;\r\n        add_header Strict-Transport-Security max-age=15768000;\r\n        default_type application\/octet-stream;\r\n        listen 443;\r\n \r\n        root \/var\/www\/Codiad-v.2.8.4;\r\n        index index.php;\r\n \r\n        server_name ide.anexistingdomain.com ;\r\n \r\n        location ~ \/.well-known {\r\n             allow all;\r\n        }\r\n \r\n        location \/ {\r\n             try_files $uri $uri\/ \/index.php?$args;\r\n        }\r\n  \r\n        location ~ \\.php$ {\r\n            include fastcgi.conf;\r\n            fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\r\n            fastcgi_buffers 16 16k;\r\n            fastcgi_buffer_size 32k;\r\n        }\r\n}\r\n<\/pre>\n<h2>Configuring Codiad Web IDE<\/h2>\n<p>Before using Codiad Web IDE for your development projects, you need to change some configurations inside the <code>\/var\/www\/Codiad-v.2.8.4\/config.php<\/code> file.<\/p>\n<h3>Updating the value of BASE_URL<\/h3>\n<p>Since you had run the initial steps when you configured Nginx to serve Codiad Web IDE through the private IP address, you need to update the <code>BASE_URL<\/code> variable to take the value of your domain name. To do so, find the code:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ndefine(&quot;BASE_URL&quot;, &quot;192.168.1.109&quot;);\r\n<\/pre>\n<p>and change it to:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ndefine(&quot;BASE_URL&quot;, &quot;ide.anexistingdomain.com&quot;);\r\n<\/pre>\n<h3>Specifying the directories where Codiad Web IDE can take as absolute paths for the projects that you want to work on <\/h3>\n<p>By default, Codiad IDE only allows absolute path to projects contained in its own source code root directory and <code>\/home<\/code>. If you want to work on projects that are contained in other directories, for example <code>\/var\/www<\/code>, find the code:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ndefine(&quot;WHITEPATHS&quot;, BASE_PATH . &quot;,\/home&quot;);\r\n<\/pre>\n<p>and change it to:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ndefine(&quot;WHITEPATHS&quot;, BASE_PATH . &quot;,\/home,\/var\/www\/&quot;);\r\n<\/pre>\n<h2>Buying the recommended hardware to setup your own Codiad Web IDE<\/h2>\n<p>If you do not have the Raspberry Pi 3 hardware mentioned in this post yet, you may want to purchase them from Amazon. Simply click on the button below to add the Raspberry Pi 3 hardware to your cart. You may remove anything that you already have or replace some of the hardware with other hardware.<\/p>\n<p><center><\/p>\n<form action=\"https:\/\/www.amazon.com\/gp\/aws\/cart\/add.html\" method=\"GET\" target=\"_blank\"><input name=\"AssociateTag\" type=\"hidden\" value=\"clivsperswebs-20\"><input name=\"SubscriptionId\" type=\"hidden\" value=\"[AKIAIMND5UBCQU2HRSUA]\"><input name=\"ASIN.1\" type=\"hidden\" value=\"B01CD5VC92\"><input name=\"Quantity.1\" type=\"hidden\" value=\"1\"><input name=\"ASIN.2\" type=\"hidden\" value=\"B073JYVKNX\"><input name=\"Quantity.2\" type=\"hidden\" value=\"1\"><input name=\"ASIN.3\" type=\"hidden\" value=\"B01F1PSFY6\"><input name=\"Quantity.3\" type=\"hidden\" value=\"1\"><input name=\"ASIN.4\" type=\"hidden\" value=\"B00MARDJZ4\"><input name=\"Quantity.4\" type=\"hidden\" value=\"1\"><input name=\"ASIN.5\" type=\"hidden\" value=\"B00N2VISLW\"><input name=\"Quantity.5\" type=\"hidden\" value=\"1\"><br \/>\n<input alt=\"Buy from Amazon.com\" name=\"add\" type=\"image\" src=\"https:\/\/images-na.ssl-images-amazon.com\/images\/G\/01\/associates\/remote-buy-box\/buy4.gif\" value=\"Buy from Amazon.com\"><\/form>\n<p><\/center><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/How-to-setup-Codiad-Web-IDE-on-your-Raspberry-Pi-3-with-Raspbian-Stretch-Lite-Nginx-and-PHP-v2.jpg\" alt=\"How to setup Codiad Web IDE on your Raspberry Pi 3 with Raspbian Stretch Lite, Nginx and PHP\" \/><\/p>\n\n      <ul id=\"social-sharing-buttons-list\">\n        <li class=\"facebook\">\n          <a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwp.me%2Fp245TQ-4z\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n            <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Facebook.png\" alt=\"Facebook icon\"> Share\n          <\/a>\n        <\/li>\n        <li class=\"twitter\">\n          <a href=\"https:\/\/twitter.com\/intent\/tweet?text=&url=https%3A%2F%2Fwp.me%2Fp245TQ-4z&via=Techcoil_com\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Twitter.png\" alt=\"Twitter icon\"> Tweet\n          <\/a>\n        <\/li>\n        <li class=\"linkedin\">\n          <a href=\"https:\/\/www.linkedin.com\/shareArticle?mini=1&title=&url=https%3A%2F%2Fwp.me%2Fp245TQ-4z&source=https:\/\/www.techcoil.com\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/linkedin.png\" alt=\"Linkedin icon\"> Share\n          <\/a>\n        <\/li>\n        <li class=\"pinterest\">\n          <a href=\"https:\/\/pinterest.com\/pin\/create\/button\/?url=https%3A%2F%2Fwww.techcoil.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F283&description=\" class=\"pin-it-button\" target=\"_blank\" role=\"button\" rel=\"nofollow\" count-layout=\"horizontal\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Pinterest.png\" alt=\"Pinterest icon\"> Save\n          <\/a>\n        <\/li>\n      <\/ul>\n    ","protected":false},"excerpt":{"rendered":"<p>A Web IDE server allows you to code wherever you are and whenever you want from any device through a web browser. A <a href=\"https:\/\/www.amazon.com\/gp\/product\/B01CD5VC92\/ref=as_li_ss_tl?smid=A30ZYR2W3VAJ0A&#038;psc=1&#038;linkCode=ll1&#038;tag=clivsperswebs-20&#038;linkId=ea3d80d91754b72a5ed6c2cfeedf2ddb\" rel=\"noopener\" target=\"_blank\">Raspberry Pi 3 board<\/a> is a good <a href=\"https:\/\/www.techcoil.com\/shop\/for\/gifts-for-programmers\" rel=\"noopener\" target=\"_blank\">gift for programmers<\/a> and if you happen to receive one or bought one and do not know what to do with it, you may want to setup <a href=\"http:\/\/How to setup Codiad Web IDE on your Raspberry Pi 3 with Raspbian Stretch Lite, Nginx and PHP\" rel=\"noopener\" target=\"_blank\">Codiad Web IDE<\/a> on it to help you code while you are on the move. <\/p>\n<p>Read on to find out how to setup Codiad Web IDE on your Raspberry Pi 3 with Raspbian Stretch Lite, Nginx and PHP as the <a href=\"https:\/\/www.techcoil.com\/lemp\/\" rel=\"noopener\" target=\"_blank\">LEMP stack<\/a>.<\/p>\n","protected":false},"author":1,"featured_media":1166,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"footnotes":""},"categories":[4],"tags":[431,23,497,389,242,266,225,13,444,243,240,308,412,445,255,195,438,391],"jetpack_featured_media_url":"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/Raspberry-Pi-3-with-Codiad-Web-IDE-window-as-the-background.jpg","jetpack_shortlink":"https:\/\/wp.me\/p245TQ-4z","jetpack-related-posts":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/283"}],"collection":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/comments?post=283"}],"version-history":[{"count":0,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/283\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media\/1166"}],"wp:attachment":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media?parent=283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/categories?post=283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/tags?post=283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}