By assep kasep
i have have two app first node js and this is running well with pm2, second app is mobile app base on ionic url m.forher.co.id, how i run this app ? error log is connection refused with 127.0.0.1:7712.
here is config on sites-enabled server { listen 80;
server_name www.forher.co.id forher.co.id;
rewrite ^ http://m.forher.co.id$request_uri? redirect;
}
and
server {
listen 80;
server_name m.forher.co.id;
client_max_body_size 200M;
location / {
include /etc/nginx/mime.types;
client_max_body_size 200M;
proxy_pass http://localhost:7712;
proxy_buffers 32 25m;
proxy_busy_buffers_size 25m;
proxy_buffer_size 24m;
proxy_ignore_headers "Cache-Control" "Expires";
proxy_max_temp_file_size 0;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection '';
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_cache_bypass $http_upgrade;
proxy_read_timeout 240000;
proxy_connect_timeout 240000;
proxy_send_timeout 240000;
proxy_intercept_errors off;
send_timeout 2400000;
}
}
i dont know to listen port to this app. because is just like html usually. thanks for answering
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Based on the configuration you provided, it seems that your mobile app is running on port 7712 on the same server as your Nginx proxy server. In order to connect to the mobile app from the Nginx proxy, you need to make sure that the mobile app is listening on the correct IP address and port.
You mentioned that your mobile app is built with Ionic, which is a framework for building mobile apps with web technologies. By default, an Ionic app is served from a local development server using the ionic serve command, which runs the app on port 8100. However, this is not suitable for production use, as the development server is not optimized for performance and security.
To run your mobile app in production, you need to build it for the web and serve it using a web server such as Nginx or Apache. Here are the general steps you can follow:
Use the following command to build your Ionic app for the web:
ionic build --prod
This will create a www directory in your app’s root directory containing the optimized web assets.
Copy the contents of the www directory to a directory that is served by Nginx. For example, if you create a directory called myapp in the Nginx html directory, you can copy the www directory to it using the following command:
sudo cp -R /path/to/your/app/www/* /usr/share/nginx/html/myapp/
Make sure to replace /path/to/your/app with the actual path to your app’s root directory.
Update your Nginx configuration file to serve your app. Here’s an example configuration:
server {
listen 80;
server_name m.forher.co.id;
location / {
root /usr/share/nginx/html/myapp/;
index index.html;
try_files $uri $uri/ /index.html;
}
}
} }
This configuration listens on port 80 for requests to m.forher.co.id, and serves the index.html file from the myapp directory. The try_files directive ensures that requests for non-existent files are redirected to the index.html file, which then loads the app’s JavaScript code.
Restart Nginx using the following command:
sudo systemctl restart nginx
Then, try accessing your app from a web browser by visiting http://m.forher.co.id.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.