vagrant cannot access webserver on localhost:8080 - centos

I am running CentOS 6.4 through vagrant.
I have put this line inside my Vagrantfile:
config.vm.network :forwarded_port, guest: 80, host: 8080
Then I have installed nginx in the VM and verified it's working with:
wget http://locahost/
Works fine.
But from my host machine (Macbook Air, Mountain Lion) when I go to:
http://localhost:8080
It times out. Did I miss any configuration in Vagrantfile?
I have used this box:
https://github.com/NREL/vagrant-boxes

Have you checked your iptables?
It's a common mistake: when you use provisioning you also have to configure your iptables. (For puppet you have this module.) If you don't want to work with a firewall you can just do vagrant ssh followed by sudo service iptables stop.

What do you see when you go to your browser? Does it say Data not received or it never stops reloading? Do you get any messages in your browser? The server config file must be a bit messed up. Try reloading the server configuration, and restarting it.
Also, try changing the port number to something else. With the newer version of Vagrant, the syntex looks a bit different. So you have to do:
config.vm.forward_port 80, 2759
This is the config file that I use for one of my instances:
Vagrant::Config.run do |config|
config.vm.box = 'rails-dev-ready'
config.vm.host_name = 'rails-dev-ready'
config.vm.forward_port 5800, 5800
config.vm.forward_port 1080, 1090
config.vm.forward_port 80, 2759
config.vm.provision :puppet,
:manifests_path => 'puppet/manifests',
:module_path => 'puppet/modules'
config.vm.share_folder "sharedapps", "/home/vagrant/sharedapps", "sharedapps"
end

I recently set up a CentOS 6.4 box. My ports got all messed up because of iptables. I just disabled the service. It's in /sbin/sevices.

You may run the following command to find out if any other process (such as Tomcat) is bind to port 8080:
lsof -i :8080
If so, that may cause the problem.

I have found a solution,
I have found that there is an issue with Apache + vagrant, and sometimes Apache won't start automatically.
Please try: sudo service apache2 start once logged in via ssh.
I was having issues with Vagrant and all the error messages indicated a networking problem, but in reality my Apache service just wasn't starting on vagrant up

Related

Cannot complete pgadmin4 setup. Apache web server

I've got problem with completing pgadmin4 installation thru sudo /usr/pgadmin4/bin/setup-web.sh command.
During this process instalator does not recognizing that Apache is running and asks me if I want to start it:
The Apache web server is not running. We can enable and start the web server for you to finish pgAdmin 4 installation. Continue (y/n)? y
Then it just spits some errors:
Too few arguments.
Error enabling . Please check the systemd logs
Too few arguments.
Error starting . Please check the systemd logs
So far I havn't found where the logs are stored.
About my apache, I am quite sure that my server is running, because I can connect to it through browser, phpmyadmin is working properly, and service apache2 status returns * apache2 is running. By my understanding apache2 is just fancy word for httpd service, and there is no other service called simply apache.
PostgreSQL seems to work properly from command line, haven't tested if I can connect to it yet, but this shouldn't be the case right?
I am using
**PostgreSQL:** 12.5 (Ubuntu 12.5-0ubuntu0.20.04.1)
**Ubuntu:** Ubuntu 20.04 LTS
**Server:** Apache/2.4.41 (Ubuntu)
I had the same issue for Debian 10 and Ubuntu 20. The /usr/pgadmin4/bin/setup-web.sh script is using 'uname -a' which doesn't contain "Debian" identifier in the return string. Updating this to read /proc/version will allow APACHE to be specified as the Debian variant of apache2.
Change:
UNAME=$(uname -a)
To:
UNAME=$(cat /proc/version)
I had a similar problem with Ubuntu running inside WSL 2. Managed to resolve it by modifying the /usr/pgadmin4/bin/setup-web.sh script. I moved these lines outside of the conditional:
IS_DEBIAN=1
APACHE=apache2
This allowed the installation to progress beyond the Too few arguments. error. There was still an error however:
System has not been booted with systemd as init system (PID 1). Can't operate.
Error restarting apache2. Please check the systemd logs
I resolved this by running:
sudo service apache2 restart
After this I tried bringing up the admin page by visiting http://127.0.0.1/pgadmin4 from the Windows host. This still didn't work, and had to connect using the Ubuntu machine's ip address (you can find it out via ifconfig) which finally allowed me to see the login page.

Django server is not reachable although ssh to the computer works

I am running a Django server on a redhat computer. I can remotely connect to the computer via ssh connection, so I am assuming there is no firewall issue. However, when I execute the following command (which supposedly should make the server publicly available)
python3 manage.py runserver 0.0.0.0:8080
The server is not reachable from any other computer. Locally (from the redhat machine itself) I can see the server is running.
I am new to redhat, so if there is any other information I should provide, please let me know.
So far, I have found that I can make my server reachable using localtunnel, however, since it changes the url, I prefer to solve the issue some other way.
UPDATE: the problem had nothing to do with Django. What made confusion was that the server was running with no problem and turned unreachable with no specific reason.
Anyways, I needed to add some configurations (found in here) to make port:8080 reachable.
Open the port 8080 with
firewall-cmd --zone=public --add-port=8080/tcp
To add it permanently to the system, add --permanent like so:
firewall-cmd --zone=public --add-port=8080/tcp --permanent

Resolve hostnames with arch linux on a RaspberryPi

I have a Pi that runs hostapd and dhcpd on arch linux to create it's own land with the Pi's (routers) IP being 10.0.0.1. This uses the wlan0 interface and it only serves as a standalone router running a web server.
Once I connect to the Pi, I use 10.0.0.1 to display the web pages, but I want to use a hostname such as firepi. I have tried using dnsmasq, but I haven't been successful. Any help would be greatly appreciated especially if you can give me some detailed examples as I am a novice.
The purpose of this system is that I have created a web app that you can use to ignite fireworks over WiFi at a safe distance. I would just like the convenience of using a hostname instead of the IP address.
I must add that I will more than likely be using an iPhone to connect to the server, should this affect anything.
Not too sure how or why but this is what I did and it is successfully working now, so this is just for future users who may need a similar setup to mine.
First I installed hostapd and dhcpd and made sure they were working. Next I changed '/etc/hostname' to firepi and the '/etc/hosts' and added '10.0.0.1 firepi'. Then I installed dnsmasq, and set the interface to wlan0, and finally added '10.0.0.1 firepi' to '/etc/resolv.conf'.
After a full reboot, I joined the network on my iPhone, navigated to firepi and sure enough, it worked!
Thanks to the other users for their advice and tips.
You can use avahi on Arch as well to resolve your hostname:
sudo pacman -S avahi nss-mdns
Start the avahi daemon:
sudo systemctl enable avahi-daemon.service
sudo systemctl start avahi-daemon.service
Edit /etc/nsswitch.conf
sudo vim /etc/nsswitch.conf
Change the line:
hosts: files myhostname dns
to
hosts: files myhostname mdns_minimal [NOTFOUND=return] dns
Reboot
Note: don't forget to add .local to your hostname.
See also:
http://blog.pixxis.be/post/77285636682/resolve-hostname-with-arch-linux-on-a-raspberry-pi
If you just want to be able to use "firepi" as hostname to connect to it, you can simply add it to your /etc/hosts file using the syntax "IP host".
To make it as easy as possible, run this command as root:
echo "10.0.0.1 firepi" >> /etc/hosts
That'll do the trick.
Can you try avahi ?
sudo apt-get install avahi-daemon and
sudo apt-get install avahi-browse
I've successfully used that on Raspian. Unless you change the hostname using
sudo raspi-config you will access via raspberrypi.local
Note that if you plan to access the RPi from Windows you will need to install Bonjour Service first(if you have iTunes intalled, you might have those, run services.msc and check if the Bonjour Service is started)
Another note: On a friend's iphone I've installed a generic vnc client and had x11vnc running on the RPi and succesfully managed to connect to the RPi (since avahi-daemon was installed)

Cannot SSH into new computer running CentOS 6.3 from Fedora 16

I just installed CentOS 6.3 on a new computer and am unable to SSH to it from our computer running Fedora 16. They are both on the same network.
Some facts:
- I can ping it from the Fedora machine.
- I can SSH to the CentOS computer to itself on the CentOS computer.
- I have looked into hosts allow and deny, I have set selinux to be permissive, I tried with iptables disabled on the Fedora computer
I am fresh out of ideas...
Thanks
Do you have fail2ban running?
Do you have denyhosts running?
Do you have iptables allowing TCP 22?
Do you have a line in your sshd_config that refers to "AllowUsers"? (most dont but some do, and if yours does, you need your account listed on that line)
Can you run this command tail -f /var/log/secure on that machine at the same time while trying to login from the second machine and spot the issue? If not, paste the output from that log here for me to comment on.
A long shot, but you might try service sshd restart and try again to see if that helps. Go ahead and run tail /varlog/messages while restarting that daemon to see if you spot anything unusual while doing that. If you spot the issue great, if you dont, post the output here for me to comment on.
Last, do this cp /etc/ssh/sshd_config /etc/ssh/sshd_config.back and then take a good known working sshd_config from another machine and place it over the top of yours and then restart the daemon again & try again.
My money is on seeing something that helps us in /var/log/secure.

Can't stop or restart JBoss AS 4.2.3 as a service in Fedora

i have a little issue with a Jboss AS 4.2.3 . I'm developing an application in Seam so i'm using Jboss as server. In the client company they have a Jboss AS 4.2.3 installed on Fedora and configured as a service, so it starts automatically on boot machine with PostgreSQL. So, if i run chkconfig --list i can see Jboss here as a service.
But the problem is when i try to restart, stop or start this service (i have root permissions) using this command:
service jboss stop/restart
But i don't know what happens that looks like it doesn't find the Jboss AS instance that's running because i get this message:
JOBSS_CMD_START = cd /opt/java/jboss/bin; /opt/java/jboss/bin/run.sh -c default
No JBossas is currently running
But it's running because if i enter localhost:8080 on a browser it loads the Jboss page. The server admin of the company doesn't know also why the service can't restart or stop or start and only i know that he followed this tutorial to install and configure JBoss AS:
thewiki4opentech.org/index.php/How_to_install_JBoss_AS_in_CentOS_/RedHat/_Fedora
Also, i tried with
/etc/init.d/jboss stop
And i get the same output. If i use
/opt/java/jboss/bin/start.sh -c default
It tries to start a second instance of Jboss AS but it gives me errors because is trying to use the same ports as already started Jboss instance.
And it's difficult to me because i'm connecting remotely using Teamviewer and i want to deploy an EAR but i can't because i can't restart the service to extract the ear. So i wanna ask you for help if you know why the Jboss AS that's running can't be stopped or started using service jboss stop.
As aditional info, i'm using the config to access Jboss apps from other machines (using 0.0.0.0) and the server has a static IP. The config of my hosts file is this:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.1.106 entertechserver.localdomain entertechserver
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Regards.
Well, i think that i found the answer. The server admin copy the script run.sh to /etc/init.d/ but we saw that there's another script named jboss_init_redhat.sh that i think is optimized for redhat/fedora systems, so we used this script to copy to /etc/init.d/ and it works!! Now when i stop it gives me the next output:
JBOSS_CMD_START = cd /opt/java/jboss/bin; /opt/java/jboss/bin/run.sh -c default -b 0.0.0.0
waiting for processes to stop
Really i haven't seen the difference between both scripts yet but it will be intersting to take a look.
Regards.