Adding environment variables

59 views
Skip to first unread message

Iain Whittaker

unread,
May 27, 2015, 10:33:05 PM5/27/15
to wordpress-...@googlegroups.com
I've recently switched to using VVV to manage my local Wordpress environment. On the live server I use environment variables to specify database, user name, password and host in wp-config and would like to do this locally too.

How do you set up environment variables for individual server blocks under vvv nginx?

Eduardo Wass

unread,
Jul 8, 2015, 6:12:03 AM7/8/15
to wordpress-...@googlegroups.com
I'm also looking for a solution for this.

Iain Whittaker

unread,
Jul 8, 2015, 6:32:23 AM7/8/15
to wordpress-...@googlegroups.com
I moved the "location ~ \.php$ {}" block out of the wp-common-config and added to the local cont sample in the sites directory with the addition of the following:

 location ~ \.php$ {
       
        fastcgi_param HOSTNAME "localhost";
        fastcgi_param PASSWORD "wp";
        fastcgi_param USER_NAME "wp";
        fastcgi_param DB_NAME “your_database_name";
      
    }

after setup, edit the individual site DB_name to be whatever and then remember to re-provision the server.

It works, but I'm sure there's a way to automate this in a cleaner way!

Eduardo Wass

unread,
Jul 8, 2015, 6:56:02 AM7/8/15
to Iain Whittaker, wordpress-...@googlegroups.com
Cool,
what I did is from ssh edit the file:

/etc/php5/fpm/pool.d/www.conf 

And at the end of file, add my vars like this:

env[WP_ENV] = development


Thanks guys


--
You received this message because you are subscribed to a topic in the Google Groups "WordPress and Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wordpress-and-vagrant/CgBBhwZS-c0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wordpress-and-va...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Eduardo Wass
Web Developer

Skype:

eduwass

Mail:

edu...@iamthegeorge.com

THE GEORGE BCN SRL | Carrer d'Àvila 112 | 08018 Barcelona, Spain

Reply all
Reply to author
Forward
0 new messages