Stuck with Configuring Varnish - centos

I successfully installed varnish etc. via the whm terminal then when it came to Configuring Varnish to listen in on port 80 for incoming http requests.
/etc/sysconfig/varnish
I do not know how to do this. I got help from the get go with the repo to command lines etc and all went off without a hitch until I got to the configure varnish section. Got stuck on step 3.
https://support.qualityunit.com/496090-How-to-install-Varnish-with-CPanel-and-CentOS-to-cache-static-content-on-server

from terminal type:
sudo nano /etc/sysconfig/varnish
The file opens, look for the VARNISH_LISTEN_PORT and change it to 80. Save and close the file and you are done

Related

How do I set my VPS Webmin/Virtualmin server to show data from MongoDB in the hosted website?

This is my first question I hope I do it right. So :
I developed a MERN website, on which I have perfect connection with a MongoDB db as well as an Amazon S3 one.
I am currently trying to host it on a Hostinger VPS with Virtualmin and Webmin. The data is in thanks to FTP working, so the website design shows but the mongoDB data is missing.
So far :
DNS set properly,
SSH all good,
mongo shell installed inside of server through the console, I can see my db and the data
new user created successfully with mongo method db.createUser(), attached to my db
So my question is : what are the following steps to make the way to data, through the server, to the website ?
I'm new to this and I've searched for several days now everywhere without any success, and the hosting support is lost on the matter...
Thanks!
By default, Virtualmin installs the LAMP/LEMP stack. there is no support for MERN/MEAN or node js based applications. you have to manually configure your server through the terminal by ssh.
follow the instruction.
Apache NodeJS installation
There is no GUI support for node based apps. but you can manage other services like mail, DNS, firewall and SSL etc for your app through Virtualmin and Webmin.
In case it helps anyone I did succeed in setting up the server, it's quite a bit of work. Here's my config :
I set Nginx to listen to the https requests from the front and send them to the back. The config file is called "default", in the folder sites-available, and has the following content :
server {
listen 80;
listen 443 ssl;
root /the/frontend/root/folder;
server_name _;
ssl on;
ssl_certificate /the/ssl/.crt/file;
ssl_certificate_key /the/ssl/.key/file;
# react app & front-end files
location / {
try_files $uri /index.html;
}
# node api reverse proxy
location /api/ {
proxy_pass http://localhost:portlistenedbybackend/api/;
}
}
The React frontend comes with a .env file that is integrated in the build. In it I set the url to where the frontend sends requests (these are then caught by Nginx). Be careful to set this url to the domain of your website when deploying, so in my case : https://example.com/api
The production process manager pm2 is useful to keep alive the backend at all times so I installed it and used it for the Node backend. The command to add the backend main server file (in my case server.js) to pm2 from the console : sudo pm2 start your/serverfile/address
Here's a couple of links that proved very useful to understand how to configure the server :
Applicable to Amazon server but a lot applicable here too : https://jasonwatmore.com/post/2019/11/18/react-nodejs-on-aws-how-to-deploy-a-mern-stack-app-to-amazon-ec2
A guide to log journal in console for debugging :
https://www.thegeekdiary.com/beginners-guide-to-journalctl-how-to-use-journalctl-to-view-and-manipulate-systemd-logs/
For setting up Webmin server : https://www.serverpronto.com/kb/cpage.php?id=Webmin
At first I discarded Webmin and Virtualmin since all I could find (from support included) was tutorials to setup the server via console. So bits by bits I set it up. Then, finally, I got from the support a tuto to setup the server from Webmin. But to this day I can't say wether that made a difference in the structure. But at least it's clean.
Last but not least, a couple of console commands I found very useful :
systemctl status theserviceyouwanttosee
systemctl start theserviceyouwanttostart
systemctl stop theserviceyouwanttostop
systemctl restart theserviceyouwanttorestart
Examples of services : nginx, mongod...
Test if Nginx is setup properly : sudo nginx -t
reload nginx config file after any modification : sudo nginx -s reload
See the last errors logged by nginx : sudo tail -f /var/log/nginx/error.log
Save current pm2 settings : pm2 save
Backend execution logs : sudo pm2 logs
Identify the processes still running with mongo (useful if mongod won't restart properly) : pgrep mongo
Kill the mongo process to be able to start fresh : kill <process>
Show all services used by server : sudo systemctl
See all processes in execution and stats of the CPU amongst other things : top
I'm still new to all of this despite my couple of weeks on the subject so this description is most probably improvable. don't hesitate to suggest any improvement, mistake, or ask questions, I'll do my best to answer them.
Cheers!

Openshift jbossews cartridge connection refused from outside but reachable from localhost

My jbossews cartridge is suddenly no more available through the webbrowser but when logged in via SSH it seems to be reachable:
What I've done so far:
When I gear restart my cartrdige, I get Found 127.3.72.129:8080 listening port.
wget 127.3.72.129:8080 actually downloads the valid index.html
With a wget on the external domain wget test-locked.rhcloud.com (also with ":8080") I just get Connection refused
Catalina log also gives no hint about any problems. It reports the server to be started up successfully without any warnings.
access log also shows no request at all coming in.
disk quota is available, too
I'm running out of ideas what I could check next or get the gear up and running again. Any help would be appreciated.
After Openshift having recovered like magically, the answer to such an issue seems to be: "relax, wait and see".

Mamp for Windows

I just installed MAMP for windows. When I try to start servers I get a message "'Apache' needs open port 80 which is already being used by another service or application. Please reconfigure 'Apache' to use free port." I've tried to change in preferences but it doesn't seem to work. Any suggestions?

I can access 127.0.0.1, but not http://localhost:8080

I have a problem. I am trying to run a simple JSP page from Eclipse:
http://postimg.org/image/z268cl1s3/
But when I run this page i get a 404 error:
http://postimg.org/image/h0rosix4z/
When I put in:
localhost
127.0.0.1
in the browser it works fine:
http://postimg.org/image/8js6hlsg3/
I can see eclipse is running it from localhost:8080, but when i type that in at the browser it gives me this error:
http://postimg.org/image/7lbtfbf43/
Does anyone know how I can activate localhost on my mac. I looked up several tutorials, but i didnt find the answer. MySQL is also running fine on the computer, so I guess there is something that dont let me access [http://localhost:8080?]
Hope someone can help me?
Best Regards
Mads
There are two issues you are having:
There is a difference between http://localhost/ (and its equivalent http://127.0.0.1) and http://localhost:8080 - the first uses port 80, the second 8080. The Tomcat server listens only to the latter, that is shown by the servers error messages, and not generic 404 messages. In other words, do not forget to add the 8080 port numbers to the end of the localhost url
The Tomcat error messages show that the resources are not available, so I would look at what Java web applications are installed - e.g. the root web application is missing (the localhost:8080 url) for sure, and I am not sure whether your MySQL connector is.
Search google for how adding an entry to the hosts file on your mac.
You'll basically link localhost to 127.0.0.1 there

JBoss VPS External ip settings - working fine in local browser but not in external

On beforehand I have to say i'm a bit of a newbie.
I've sucscribed to a VPS with Ubuntu 11.04 server, I installed Jboss and am starting it with the -b 0.0.0.0 option.
Now if I lookup the address ip:8080 on a browser on the VPS itself it's working fine, but if I try to look it up on a browser on an external machine it isn't able to access the page.
I tried to modify the hosts file but without success. Maybe its the iptables? Or something else?
I really appreciate any help thanks.
Take the static IP of the server, ping that from your command line tool with ping. If you are successful in pinging the server you are all set. Now go to the browser of the external pc and type the static ip and give the port as 8080. It will certainly work.
Some good suggestion from my side is, try PaaS(platform as a service) now as that is much easier than VPS and you will get up and running in minutes. Try Jelastic. It has got JBoss hosting. Deploy your WAR file there and you can access it immediately. Ket me know if you really go ahead and use it.
Surya