X

Important Notice:

It has come to our attention that some individuals, who are not affiliated with eGlobe IT Solutions, have been reaching out to job seekers falsely claiming to represent our company. These scammers are offering Work from Home Part-Time job opportunities under the guise of eGlobe IT Solutions and we have already reported to the concerned authorities under law. If you have been contacted by someone claiming to be from eGlobe IT Solutions via WhatsApp/Instagram/Facebook/SMS and you suspect that it might be a scam, we urge you to exercise caution. Do not share any personal information or make any financial transactions. Instead, pleasefollow these steps:

1. Contact Us:

If you have doubts or concerns, please reach out to our HR department directly at hr@eglobeits.com to confirm the authenticity of the communication.

2. Do Not Share Personal or Financial Information:

Under no circumstances should you share sensitive personal or financial information with anyone claiming to be from eGlobe IT Solutions without proper verification.

3. Report the Scam:

If you believe you have been targeted by a scam, please report it to your local law enforcement authorities and forward any suspicious emails or messages to us at hr@eglobeits.com so that we can take appropriate action.

Your safety and security are of paramount importance to us, and we take these matters very seriously. eGlobe IT Solutions is committed to maintaining the highest ethical standards in our recruitment processes.

Setting Up Nginx Container Using Docker: A Step-by-Step Guide To Deployment

Posted on: 26 Nov 2019 by Admin

By using docker you can run the Nginx container easily by switching the development environment without making any configuration changes on the host machine.
When multiple application is built parallelly from a local development environment, it is hard to switch the environment configurations based on application requirement and build all the applications using the same environment configuration.
Docker nginx example, if you are working on with an older version of Nginx and needed to start another application which requires an upgraded version of Nginx, at that point of time you need to Switch the Nginx version, it is not that too easy and unexpected issues may also occur, which can draw back your resource and time.
Now Docker helps to come up with this scenario.
Almost 90% of Magento Development Company across the globe use Docker as a platform for their Magento Development Services

Nginx docker-compose is mainly used by developers as it is cost-efficient to build and manage your application portfolio in own pace.
now let’s look into the steps involved in setting up Nginx Container using Docker.

Prerequisites

A working version of docker community edition software is installed on your machine. If not, please find the guide on How to install docker Docker-compose is installed on your host machine. Learn How to install docker-compose “docker” command should be able to run without “sudo”. If not follow learn how to configure Docker to run without sudo

Readiness check

Run below command on your host machine’s terminal:

docker-compose -v

Once you complete the run command
It shows the result like this ” docker-compose version 1.22.0, build f46880f”
If you are troubled in readiness check please troubleshoot the docker installation.
Let’s start creating a container using the simple steps

Step 1:
Now we are going to create a directory for adding docker files to your host machine.
Note: we request you to preferably try in your project path itself,
also please make sure that you are updating your .gitignore file to avoid accident commits.

$ cd /path/to/your/project/ $ mkdir docker $ cd docker
Step 2:
Create “docker-compose.xml” file the docker directory. Add below content to the yml file.
version: "3" services: nginx_myapp: build: context: ./nginx ports: - "80:80"

volumes: - ../:/var/www/myapp - ./nginx/config/myapp.conf:/etc/nginx/conf.d/myapp.conf

 networks: myappnetwork: ipv4_address: 172.25.0.1 networks: myappnetwork: driver:

bridge ipam: config: - subnet: 172.25.0.0/24
Not sure what’s meant by the above content? Don’t worry you can find the explanation of each keyword used here at Docker compose file reference
Step 3: Create a Docker file
You will need to create a new directory “nginx” inside the docker directory.
$ mkdir nginx
Now navigate to nginx directory and create a new file “Dockerfile” – as you see without any file extension.
$ touch Dockerfile
Add below content to the Dockerfile.
FROM nginx:1.9

Write nginx configuration
Now you will need to write the vhost configuration to make your website visible with a dummy domain name (something like www.myapp-local.com).
In order to write nginx configuration, create “my app.conf” file in “docker/nginx/config/” directory.

$ mkdir config $ cd config $ touch myapp.conf

Then add below vhost configuration to a myapp.conf file using your favorite editor.

server { listen 80; server_name www.myapp-local.com; root /var/www/myapp; }

Make sure that the file names you used are in the above sample or feel free to make necessary changes to the docker-compose.yml file.
Step 4: Modify your host file
In order to point the domain “www.myapp-local.com” to the nginx container (IP: 172.25.0.1), you will need to modify your “/etc/hosts” file and add below the record. For Mac users

$ 127.0.0.1 www.myapp-local.com myapp-local.com

For Other Operating system users

$ 172.25.0.1 www.myapp-local.com myapp-local.com

Step 5: Write an HTML file
Switch to your project directory (assuming that you created “docker” in your project directory) and then create “index.html”.

$ cd /path/to/your/project/ $ touch index.html

Add below content to index.html
My Nginx Container!
Step 6: Execute docker-compose
Now you are all set to run the docker-compose command to build your nginx container.
Execute below commands.
Make sure If you are into the “docker” directory, else switch to that directory and run below command.

$ docker-compose up

As I mentioned above if you are facing any errors while running the command, Please do a troubleshoot
You can now check your domain to see whether the request is reaching the right container.
Open your favorite browser and access http://www.myapp-local.com/

From this tutorial you have learned how to setup Nginx Container using Docker if you have any doubt place your comments.