Vagrant Jekyll serve not available - vagrant

I decided to try Jekyll, but as I have not used it I encountered a problem. When i serve it i get "This webpage is not available" on http://127.0.0.1:4000/. I'm using vagrant.
vagrant#ruby-jekyll-box:~$ jekyll new portfolio
New jekyll site installed in /home/vagrant/portfolio.
vagrant#ruby-jekyll-box:~$ cd portfolio/
vagrant#ruby-jekyll-box:~/portfolio$ jekyll serve
Configuration file: /home/vagrant/portfolio/_config.yml
Source: /home/vagrant/portfolio
Destination: /home/vagrant/portfolio/_site
Generating...
done.
Auto-regeneration: enabled for '/home/vagrant/portfolio'
Configuration file: /home/vagrant/portfolio/_config.yml
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
What am I doing wrong?

are you trying to access it from inside the vagrant box? or from the computer you are running the vm on? 127.0.0.1 is localhost/loopback so 127.0.0.1 inside the vagrant box is not the same 127.0.0.1 on your computer.
try
jekyll serve --host=0.0.0.0
and then accessing it from your host computer at http://ip.of.vagrant.box:4000/

Related

Not found error on setting up local server using LAMPP

When I enter localhost/hello.php in my browser, I get below error.
Not Found
The requested URL /hello.php was not found on this server.
Apache/2.4.18 (Ubuntu) Server at localhost Port 80
I think there is some compatibility issue in the LAMPP and Ubuntu.
To start apache2 normally you need to first hard stop it through following command:
Sudo service apache2 stop.
And then restart the apache2 or LAMPP . This worked for me.

Unable to connect to Apache server over HTTPS on Centos7 on VirtualBox from MAC

I have a Centos 7 OS configured on VirtualBox machine. I have installed X509 certificate using Openssl tool and configured the apache HTTPD server.
I connect to Centos7 guest on VirtualBox via SSH on my local MAC OSX Seirra (10.12.3) on terminal using root. I have verified that /etc/host on my MAC is correctly pointing to the guest on VirtualBox. Also verified the port forwarding on VirtualBox and they are all setup correctly for allowing traffic on 80 (http) and 443 (https) and 22 (ssh).Also I have made sure that Apache user has proper previleges on the index.html and other folders under DocumentRoot folder. I have also verified that /etc/host on my MAC is correctly pointing to a guest running on VirtualBox.
I have set the firewall to :
setenforce 0
So hopefully it is not a SELinux issue.
Then I run following command on terminal as root user of my Centos7 OS :
curl https://localhost -k
and I do get the default index.html file content.
But then, when I go to my MAC OS browser to connect to VirtualBOX website on HTTPS, I see following message on Chrome browser :
This site can’t be reached localhost refused to connect.
Please note that I can connect to my Vbox CentOS HTTPD server on HTTP.
So what is going wrong here when trying to access the apache server using HTTPS?
You must enable access to https using firewall-cmd:
# firewall-cmd --permanent --add-service=https
or
# firewall-cmd --permanent --add-port=443/tcp
then reload the rules
# firewall-cmd --reload
Try this once.
systemctl stop firewalld
After that try to access website.

How to run Jekyll on a virtual box server?

I'm on a Windows 7 x64 machine with Virtual Box and Vagrant installed. I installed
Ruby
Rubygems
correctly and installed jekyll. The final message I received on my PuTTY terminal is :
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
When I visit the url on Windows Chrome browser, it says
This site can’t be reached
127.0.0.1 refused to connect.
What are the extra configurations that needs to be done so that Jekyll can run on the virtual box server?
To access the jekyll instance in the virtual box server, run Jekyll with the server IP.
Usage:
jekyll serve [options]
Options:
-H, --host [HOST] Host to bind to
Supposing the virtual server IP is 192.168.1.100 then run the following command in the server to make the jekyll instance accesible from outside:
jekyll serve -H 192.168.1.100
Then it will be accessible at http://192.168.1.100:4000
If you dont use a static IP as mentioned in the other OP, you need to forward the port where jekyll will run
In your Vagrantfile
config.vm.network :public_network
config.vm.network :forwarded_port, guest: 4000, host: 4000,
You will start jekyll using the command
jekyll serve --host 0.0.0.0
Then you could access your site from http://localhost:4000/ from your host machine

Running polymer serve to serve publically in a virtual machine (VM)

Using the Polymer CLI, can polymer serve be used to run the web server publicly so the computer hosting the VM can see the site? i.e. hosting it like a normal webserver?
To place this in context, I'd like to use Polymer CLI in a Vagrant created VM and run polymer serve in the virtual machine to see the results and isolate the environment.
I started trying polymer this morning and ran across the same problem/question as i didnt want to try on my host machine.
Here is what i did:
sudo a2enmod proxy_http
sudo nano /etc/apache2/sites-available/000-default.conf
added to vhost-entry:
ProxyPass /polymer/ http://localhost:8080/
ProxyPassReverse /polymer/ http://localhost:8080/
sudo service apache2 restart
Please dont kill me guys, if its stupid, but it seems to work so far.

Can't access Ruby server on VM from host machine

I have a VM set up running Ubuntu server 14.04. In my VM I have created the following Ruby/Sinatra app:
require 'sinatra'
set :environment, :production
set :bind, '0.0.0.0'
get '/' do
"Hello World!"
end
When I execute this using ruby hello.rb I get the following output:
[2015-03-09 16:58:34] INFO WEBrick 1.3.1
[2015-03-09 16:58:34] INFO ruby 2.1.5 (2014-11-13) [x86_64-linux]
== Sinatra/1.4.5 has taken the stage on 4567 for production with backup from WEBrick
[2015-03-09 16:58:34] INFO WEBrick::HTTPServer#start: pid=2258 port=4567
Everything seems to work fine, but when I try to access localhost:4567 from my host machine (Windows 8.1) I get a GET http://localhost:4567/ net::ERR_CONNECTION_REFUSED error (in Chrome).
If I try to access the server from within my VM (ex, by using wget http://localhost:4567) it works fine.
I also have Apache2.4 running in my VM, which works fine, but I disabled it when trying to access my Ruby server by running sudo service apache2 stop.
What could the problem be? I have no problem running regular Ruby files, and I can access my Ruby/Sinatra app if I use Apache2 with Phusion Passenger. But when I simply run ruby hello.rb I can't access it from my host machine.
localhost refers to your local host, which in the case of Windows is not the same as your Ubuntu instance.
You'll need to connect to your Ubuntu instance IP directly, whatever that is. Usually you can find out with ip addr or ifconfig.
If you need a friendly DNS name you can put in your browser, xip.io provides one.
If you're using Vagrant then you can configure port forwarding so you can still use localhost if you want. Without port forwarding you will not be able to connect indirectly.
I have the network adapter for my VM attached to NAT. I was forwarding ports 443, 22 and 80 to my VM, and accessing my server on those ports works fine. Since I was running the Ruby WEBrick server on the default port 4567, I just had to forward port 4567 from my host machine to my VM as well.
After that change, typing http://localhost:4567 into my web browser served up the content from my Ruby file.

Resources