Hello,

I did create this basic word press vagrant for some friends, feel free to
copy/edit, etc, it's based on the Digital Ocean document, just I make it
more simple since not all the features are needed.

https://github.com/kikitux/wp-vagrant

Alvaro

On Wed, Jan 13, 2016 at 11:46 PM, Jimbo Jones <[email protected]> wrote:

> I am having a strange issue at the moment where when I browse to a
> port-forwarded URI (in this case http://localhost:9001) of a Vagrant box
> in my browser I get redirected back to localhost (default server). I'm not
> sure why this is happening and it's really frustrating.
>
> On my guest machine I have the root folder hosted in /var/www/wordpress
> and this is my /nginx/sites-available/nginx_vhost file:
>
> server {
>     listen 80;
>     listen [::]:80 ipv6only=on;
>
>     root /var/www/wordpress;
>     index index.php index.html index.htm;
>
>     server_name localhost;
>
>     location / {
>             # try_files $uri $uri/ =404;
>             try_files $uri $uri/ /index.php?q=$uri&$args;
>     }
>
>     error_page 404 /404.html;
>
>     error_page 500 502 503 504 /50x.html;
>     location = /50x.html {
>             root /usr/share/nginx/html;
>     }
>
>     location ~* \.php$ {
>             try_files $uri =404;
>             fastcgi_split_path_info ^(.+\.php)(/.+)$;
>             fastcgi_pass unix:/var/run/php5-fpm.sock;
>             fastcgi_index index.php;
>             include fastcgi_params;
>             #fastcgi_read_timeout 300;
>             #proxy_read_timeout 300;
>     }
>
> }
>
> Here is my Vagrant file:
>
> Vagrant.configure("2") do |config|
> # Set Vagrant box to use
> config.vm.box = "ubuntu/trusty64"
> # Configure port forwarding
> config.vm.network :forwarded_port, guest: 80, host: 9001, auto_correct: true
> # Set synched folder
> config.vm.synced_folder "./", "/var/www/wordpress", create: true, group: 
> "www-data", owner: "www-data"
> # Configure the VM
> config.vm.provider "virtualbox" do |v|
>     v.name = "Pet Vets Vagrant Box"
>     v.customize ["modifyvm", :id, "--memory", "1024"]end
> # Set up shell provisioning
> config.vm.provision :shell, :path => "bootstrap.sh"
>
> end
>
> And my bootstrap.sh file:
>
> #!/bin/bash
>
> echo "Provisioning virtual machine..."
> apt-get update
>
> echo "Installing Tree..."
> apt-get install tree
>
> echo "Installing Git"
> apt-get install git -y > /dev/null
>
> echo "Installing Nginx"
> apt-get install nginx -y >/dev/null
>
> echo "Configuring Nginx"
> cp /var/www/wordpress/nginx_vhost /etc/nginx/sites-available/nginx_vhost > 
> /dev/null
>
> ln -s /etc/nginx/sites-available/nginx_vhost 
> /etc/nginx/sites-enabled/nginx_vhost
>
> rm /etc/nginx/sites-available/default
>
> service nginx restart > /dev/null
>
> echo "Updating PHP repository"
> apt-get install python-software-properties build-essential -y > /dev/null
> add-apt-repository ppa:ondrej/php5 -y > /dev/null
> apt-get update > /dev/null
>
> echo "Installing PHP"
> apt-get install php5-common php5-dev php5-cli php5-fpm libssh2-php -y > 
> /dev/null
>
> echo "Installing PHP extensions"
> apt-get install curl php5-curl php5-gd php5-mcrypt php5-mysql -y > /dev/null
> apt-get install libapache2-mod-php5
>
> The Wordpress installation works fine when I host it on nGinx locally (not
> using Vagrant) but as soon as I place it in a Vagrant box it doesn't want
> to play. Does anyone have any ideas? I presume it's something to do with my
> Vagrant box setup but i'm not sure what!
>
> Thanks!
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/vagrant/issues
> IRC: #vagrant on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/33cab695-cc0c-4b49-9868-60215c110223%40googlegroups.com
> <https://groups.google.com/d/msgid/vagrant-up/33cab695-cc0c-4b49-9868-60215c110223%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/CAHqq0ezNYik_WuAM-vOByie6L-aZcVmBbgkqTywBzRfjOc-L%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to