How to deploy a second strapi project to server - node.js

Deploying the first one was relatively easy, I just moved the folder to the server and using 'strapi start' and 'npm start' from linux terminal gets it up and running.
Now I would like to add an additonal strapi project to a sub directory and run in, so it's accessible from the url mysite/second-project.
But how can I run another project simultanouesly?
Thanks in advance

You probably can't use the <Host-Name>:80 to point towards two different strapi application since they run on different ports.
What you can do is specify your ngix or apache config to redirect specific folder structure to different strapi applications on different ports.
Suppose you have one application running on port 8080 and another application on port 8181 and then configure you nginx so that the incoming urls are redirected in such way:
+--- host --------> strapi application on localhost:8080
|
users --> nginx --|--- host/second-project ---> strapi application on localhost:8181
|
+--- host/mail ---> strapi application on localhost:8282

Related

Running react/node on ec2 with nginx not working

I have a react and node application I'm trying to put on ec2. I have nginx installed and copied the application to root/testing-123. The application has a client folder for the react app and a server folder for the node app which uses
app.use(express.static(path.resolve(__dirname, '../client/build')));
to show the react app.
I'm trying to set it up and have it run publicly. When I go to the Public IPv4 address I get the default nginx page. How can I get it to show the application?
(Many tutorials were saying to change the sites-available/default file, but I don't have that folder, instead I have nginx.conf, but I don't know what to edit in that file.)

Deploying dynamic Nextjs + Nodejs application inside docker using caddy server

I am currently developing a simple portfolio app and my app structure is like this.
Nextjs/client,
Nodejs/server,
Mongodb/db
Nextjs is hosted locally on port 3001, Nodejs app on 5000. Whenever nextjs needs to fetch any api it calls nodejs application. All the things are configured inside docker. I am very new to deploying nextjs application and have recently used caddy server which has automatic https.
I am able to deploy the nextjs application statically using commands
next build
next export
The statically exported file called index.html inside out directory of nextjs application is pointed to caddy server on port 80 and 443. Statically exported app doesn't support api routes which I recently came to know. I tried next build and next start command to generate a dynamic production build inside .next directory. The main problem is How do I point my dynamically generated nextjs application in caddy configuration inside docker container. My present caddy configuration looks like
www.example.com:443 {
tls xyz#email.com
root * /srv
route {
reverse_proxy /api* api-server:5000
try_files {path} {path}/ /index.html
file_server
}
}
I am looking for hints especially related to proxy server.
Thank you in advance
I'm assuming the api url in your frontend looks like this http://localhost:5000 (based on your youtube comment here) which won't work if you're accessing your dockerized app from a remote computer (in this case your computer, since I'm assuming your app is hosted). Try changing it to https://www.example.com:5000 and rebuild your image.

How can I run Laravel mix on custom URL?

I am creating one application that needs to be made on staging server from one point. Because creating it on local is impossible as it has some endpoints that other servers in network has to access.
I have created an application in Vue.js and Laravel. In local, I used to run npm run hot so that I don't have to re-compile when I change some code. But as I have to continue developing this application on a live server, I want to run npm run hot on a custom domain like staging.something.com instead of localhost:8080.
I don't have any issue if somehow localhost:8080 co-operates but when I run npm run hot on a live server, Here is the error I get when I try to access the web application.
GET http://localhost:8080//js/app.js net::ERR_CONNECTION_REFUSED
I think it should show IP address of my server instead of localhost. I don't know what's wrong with this but it's not working.
Laravel mix uses the webpack-dev-server package for the run hot command.
webpack-dev-server has a switch --useLocalIp which will make it use the servers local IP address.
It also has a --host switch which can be used to set the IP address manually --host 0.0.0.0

How to run multi Laravel projects on XAMPP or Wamp

I have one laravel project in Xampp and I set my localhost to localhost/laravel/public
and now I want to start another laravel project and now I dont know what should I do.
I created a laravel project in another folder named : blog
but laravel router doesnt work anyway
You need to use virtual hosts (if you're using Apache) to map different hostnames to different directories on the same server.
https://httpd.apache.org/docs/current/vhosts/examples.html
If you're using Nginx, you would use "server blocks"
I assume that you are not in the production environment, and trying locally to develop. In this case, you can run the built-in laravel php server using the artisan command.
Normal usage.
//run this command inside your folder, in this case inside blog folder.
php artisan serv
This will start the server on localhost:8000. However, the above command also accept a parameter called port. Run the above command in other laravel project folder with a different port.
php artisan serv --port=9000
Which will run the server in 9000 port and can be tested using localhost:9000.
If you are using for production purpose, try apache virtual host or nginx virtual host based on your server.

How to access stronglooop loopback application which is running on a subfolder on live server

I have installed strongloop loopback application on a live server on domain e.g: www.abc.com . I have created stronglooop loopback project in a subfolder called "lb" After successfull creation I executed the command "slc run" the terminal logs that your loopback app is running on http://localhost:3000 but when I opened www.abc.com/lb or www.abc.com:3000/lb... it was not running there ... What mistake I did? thanks in advance.
Your loopback running on same domain but on another port so you can access it by http://www.example.com:3000
It's doesn't matter which folder your application is stored. When you run it, by default it runs on default domain on port 3000.
You should be able to deploy your app to that server using the command:
$ slc deploy http://user:pass#prod1.example.com:3000
This is also documented here

Resources