How to Deploy NuxtJS Project on Shared Hosting? - javascript

I developed a NuxtJS project locally and am trying to figure out how to deploy my project to a shared hosting provider list Host Gator.
I want to use the server side rendering functionality of NuxtJS so I will need to run
npm run build
But once I do that I'm not sure the correct steps to then deploy that built project to shared hosting?

As #AlexanderStaroselsky says, you will not be able to deploy successfully to shared hosting although it isn't because you can't run node, you probably can, it is because you can't run a reverse proxy once you deploy. I once foolishly tried to deploy a nuxt app to Godaddy shared hosting and it was a total nightmare.
I gained shell access and installed node and transferred all the files and ran npm run build and then npm start. All of this went fine and then was confronted with the issue of how to direct traffic to the nuxt app. On shared hosting you use a .htaccess file to direct to index.php or index.html but you need to make the rewrite rule to direct to http://localhost:3000 which you can put into your rewrite rule but it seems to block the correct functioning of the app. I was able to get the app visible but it didn't have any functionality. The routing didn't work, any images sourced through require('~/assets/images/...') didn't display and it was totally unworkable.
What you need is to be able to install nginx to set a reverse proxy and shared hosting never offers root privileges for you to be able to install it. What you need is a cloud hosting provider which gives you a virtual server with full root privileges to install nginx, node, and any other packages you might want. There are plenty of them out there that are affordable (probably more so than shared hosting) and easy to use, such as digitalocean, aws, google cloud, upcloud and so forth.
There can be a bit involved in deploying a nuxt app especially if you are using a rest api and then more so if you wish to add an ssl certificate but there is documentation out there to do it.
All that said, if by some miracle you ever find a way to successfully deploy to shared hosting let me know and I can dust off my godaddy account that I stupidly paid for several years worth of and don't use.

Related

Where to put builded nodejs application on my apache2 server

I am building project which I want to deploy on my own static ip server (apache2). I am using postgresql database and python api (want to use it just as API not frontend), currently I am making frontend where I need to use node packages because I need to download and install OpenLayers for usage with OSM maps, when I build nodejs project I get dist/ directory which I need to put to production. I would like to know if it means that I can just put it to /var/www/html directory and if no please where should put it? Or please some explanation how it works :) Thank you very much.
Putting the /dist directory in the /var/www/html directory is fine if it's a static build of the project, but it's recommended that you setup a virtual host so you can configure different sites served by a single Apache instance (e.g. you can run different projects on different sub-domains).
See this guide on setting up a virtual host on Ubuntu.

How can I deploy a MERN app? Is a shared server on Hostgator not enough?

I currently have a React-only app deployed on Hostgator (I used npm run build then just uploaded the files to cPanel) because it is just a front-end landing page. However, I am planning to add things like logging in and a user dashboard, which will "require" me to use Node.js, Express and MongoDB Atlas.
In this scenario, will it still be possible to deploy the website onto shared hosting on cPanel? It seems to me, from looking online, that this is not possible. In this case, what are my options for other hosting to deploy a MERN stack app on, and what are my options for backend hosting on cPanel that are not Node.js-Express-MongoDB? Do they have their own backend services?
Thank you!
I had the same query and the only solution that I could find was that it is not possible to deploy your MERN app on shared hosting and you need a dedicated server for your applications.
The best and cheaper way to do this is, wrap your application inside a container using Docker and deploy the docker image on a VPS (Virtual Private Server).
Or,
You can also use a separate service for everything that you have to configure yourself and then deploy your app. Kubernetes is the best tool to manage distributed systems.
I hope this helped you.

How do I configure cors-anywhere rate limit and whitelist?

I'm relatively new to web development and I just want to know how I can configure my own version of cors-anywhere before I host it on heroku.
I currently have the cors-anywhere folder with all of its node-modules downloaded and I want to know how to configure the rate limit so that there is no limit for my website only.
Edit: I also don't know whether or not I should create my own javascript file to configure it or if I should change the files in cors-anywhere directly before hosting it to heroku.
I figured it out, for heroku you have to use the terminal command heroku config:set ENVIRONMENTVARIABLE=value for environment variables on heroku apps. From here, you can simply set your environment variables in correspondance with cors-anywhere syntax

How to deploy Node.js REST API to production mode

I've created a REST API using Node.js and Express, so now I need to share it and publish it on a server in order to connect from Front-end.
Can you tell me a proper way to do it?
You could use Heroku for deployment, this way you can know how your app will fare. It's free moreover.
If you're satisfied with it then you can go ahead and buy a dyno or use other platforms like Azure or AWS.
To learn more on how to deploy your existing app to Heroku, visit this page.
The question you are asking is very broad. It can be done in a lot of ways. For me this 2 part tutorial was very helpful:
https://hackernoon.com/tutorial-creating-and-managing-a-node-js-server-on-aws-part-1-d67367ac5171. However, this only covers the installation on AWS EC2. This doesn't differ much from deploying it to Google Cloud, Azure or something local.
In general you need to fix the following steps:
1) Create a server somewhere (local or in the cloud)
2) Install all the stuff to run your app. In your case Node.js at least
3) Put a copy of your app on the server
4) Run it with node
5) Go to the ip of the server
The tutorial gives more details. DISCLAIMER: If you actually want to use this in production there is way more to consider. For example, security policies, setting up proxies, installing certificates etc. Please read up on that properly before you start running production apps.
You can install node on the the production server and then where the project is situated just .
copy that path
Open the Cmd >>
Enter "cd copied path .>>enter
you npm will be install & REST Api will Work.

MeteorJS and IoT Space

I want deploy a Meteor application on a wago industrial PLC 750-8202.
Wago supports Boards Support Package with the PTXdist tooling support (Communicate with CoDeSys program on a Linux-based WAGO PFC200 PLC).
I have no idea how i can utilize meteor on such a platform.
Have you any ideas how the steps can be realized to add meteor support for wago plcs ?
It is has linux on it, just SSH to your PLC. Make sure it is connected to your local network.
Now you can install node and everything else. It is like you have your own VPS. Configure everything. You can even install ftp server and upload your files over FTP. Or create small script that will be triggered from Github hooks and update your PLC as soon as you push changes to master branch.

Categories

Resources