So I have been trying to add script.js into my /var/www/html/ directory in a UBUNTU EC2 AWS Instance using VS Code Remote SSH extension. The directory has 777 permission yet when I save my file, the server stops responding and I can not connect to it through VS Code, terminal, nor the AWS CloudShell. I also can not access the public DNS to see my website anymore either.
I have the port 22 on 0.0.0.0 and all security groups correctly configured. The status checks all come back 2/2. I also have LAMP stack installed. Any ideas?
I never deployed any project before and I'm currently running with an issue while deploying a next.js app to godaddy. I uploaded my next.js app to the public_html folder of my cpanel and then i connected through ssh and executed the npm run dev command with server.js pointing to my domain name as hostname and 3000 as port number however, to access it i will have to write in the url www.mydomain.com:3000 . I learned that in order to access it by the following url www.mydomain.com I have to specify port 80 in the server.js file. However, when I do so and run the npm run dev command it says that I do not have the permission to port 0:0:0:0:80
Screenshot here
I have a VPS server and a domain name. I am doing something wrong or is there something I missed? Should I not use my domain name as hostname in the server.js file? Should I maybe keep the hostname as my VPS ip and port 3000 then point my domain to read from this address? I am a beginner with no previous exprience in deployement and this is my first next.js app ever.
Any help is appreciated and thank you!
I have created a project using angular-universal.
after building the project it created browser, server, server.js and prerender.js. I want to know how it can run on the nginx.
with the current scenario i create the build of the project send it's zip file to the /var/www/html and unzip it there and it runs.
Make sure your angular ssr project is running on same port , which you domain is listning to in nginx configuration file.
By default it listnes to 80 port , you need to change that port number in nginx configuration file and restart the server.
I'm using MulterJS for upload files from my Angular project with Express for Server Side.I had test on my development(Windows,Mac OS) on local and network.It can upload normally.but when I put my code on linux server it's can't upload any file in same code. I don't know how to fix this problem.
Initially I changed permission on destination folder to 777 so that It not work. Please Help ,Sorry for my Bad in English.
On any test PC or Server. I run this project in Server side npm start on port 3000
I solved by my self. I forgot to change API path and route to same with express on Client-Side. Thanks #HRK44
I have developed node rest api and vuejs web applications,
Im trying to deploy both project in to one aws server which run ubuntu.
Both applications have different port,
domain I try to configure api.example.com for api and example.com for vue app.
I can run both applications once after running the command in SSH, but I need them to run it forever.
What I did,
Deploy to apps separately
Apps can access with ports
I need them access
api.example.com
example.com
what are the step to do,
Any changes host file.
I found another way to deploy vue app and express/nodejs in one server without using PM. This what I did
Build your vue code using npm run build command. This will create a folder dist which should have index.html file and static folder.
Copy dist folder into your server code repository. In my case I created a folder public and moved the dist folder inside public.
In app.js file right before module.exports=app line, copy the following lines of code
//These 2 lines make sure that vue and express app are coming from the same server.
app.use('/static', express.static(path.join(__dirname,"../public/dist/static/")));
app.get('/', function(req,res) {
res.sendFile('index.html', { root: path.join(__dirname, '../public/dist/') });
});
First line make sure that the /static folder is accessible and second line will serve the index.html file when you run the node server. Routing between components will be taken care by vue.
This is how we are running our VueJS UI and ExpressJS REST API from the same server.
We are managing our services with PM2.
VueJS (Dev Environment, You can add the same settings to production)
In package.json add "start": "HOST='0.0.0.0' PORT=80 npm run dev",, where 80 is the port VueJS is listening on, to the "scripts": {..} array. Then, after installing PM2, (for dev) we can start VueJS with cd /location/of/vue/root; sudo pm2 start npm run dev --name Vue -- start. (Make sure that Apache is not running).
Please note that setting the HOST to 0.0.0.0 is important. Do not set it to LocalHost or your Servers IP address or you may run into issues.
ExpressJS
In the /location/of/express/app.js add this similar to the bottom of the file:
app.listen(process.env.PORT || 8081), where 8081 is the port your REST API should be listening on. I can then start it with sudo pm2 start /location/of/express/app.js --name Express
At this point, the VueJS should be available at www.example.com (implied Port 80) and the REST API would be available at www.example.com:8081.
If you want to have api.example.com/ point to the API, you need to make sure that your DNS is pointing the "api" subdomain to the desired port, or you may have to add the port into the URL as above.
Additionally, you can easily follow the logs through PM2 as well with pm2 logs APPNAME --lines 100.