Navigate into the front-end directory and install all required npm packages with the command cd /opt/front-end & sudo npm install.Clone the React + Redux project into the /opt/front-end directory with the command sudo git clone /opt/front-end.Only port 80 (HTTP) is publicly accessible on the server so we can't hit the API yet, this will be possible after we've configured NGINX as a reverse proxy to pass through HTTP traffic to the api (more on this shortly).įollow these steps to setup the React application on the server. ![]() The API is now running on Node.js under the PM2 process manager and listening on port 4000. Start the API using the PM2 process manager with command sudo pm2 start server.js.Navigate into the back-end directory and install all required npm packages with the command cd /opt/back-end & sudo npm install.Clone the Node.js + MongoDB API project into the /opt/back-end directory with the command sudo git clone /opt/back-end.While connected to the new AWS EC2 instance in the terminal window, run the following command:įor instructions on how to securely connect to the remote MongoDB server from your local machine using Mongo Shell or MongoDB Compass see Connect to remote MongoDB on AWS EC2 simply and securely via SSH tunnel.įollow these steps to setup the Node.js API on the server and configure NGINX to enable access to it. The below command executes a script to automatically setup and configure a production ready MERN Stack web server on Ubuntu that includes Node.js, MongoDB, PM2, NGINX and UFW.įor more details about how the script works see Setup Node.js + MongoDB Production Server on Ubuntu. Setup Web Server with Node.js + MongoDB + NGINX NOTE: If you're using Windows you can connect to your instance via SSH using the PuTTY SSH client, for instructions see Connect Using PuTTY in the AWS docs. Enter yes to the prompt "Are you sure you want to continue connecting (yes/no)?" to add the url to your list of known hosts. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |