Setting up nginx via puppet - nginx

I am trying to use puppet to set up nginx. I found this module:
https://github.com/example42/puppet-nginx
I am using Vagrant, which I believe includes all the modules in the "modules" directory. I have added puppet-nginx into that directory.
I have a manifest file which has:
class { "nginx": }
However, that doesn't seem to work.
Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class nginx at /tmp/vagrant-puppet/manifests/default.pp:50 on node vagrant-ubuntu-raring-64
Any idea why this isn't working?
Thanks!

Check that you configured Vagrant properly:
provisioning with Puppet must be enabled
you can try to set module_path explicitly
try to rename directory puppet-nginx to nginx (or create symlink)

In your Vagrant directory issue
puppet module install --force "example42/nginx" --target-dir ./puppet/modules
Make sure your Vagrantfile contains the following:
config.vm.provision :puppet do |puppet|
puppet.module_path = 'puppet/modules'
end

Related

Consul template is not restarting nginx windows

I am using consul template v0.19.0 for windows, for rendering nginx config.
The nginx config Is rendering fine by the consul template but It is not restarting the nginx.
This is the command I am using.
Consul- template -consul-address="xx" - template="in:out:{{pathfornginx}}\nginx.exe -s reload" .
Where "in" is the ctmpl path and "out" is the final nginx config path..
I have tried with different path format but no luck.
Could anyone drop some input on this.
Thx in advance.
Did you tried to create a config.json file which will contain the path to the ctmpl file, and the command itself?
You would need to use the -config flag instead of -template
If you want an example for the config.json I can provide you one.. I'm using similar setup and it works fine for me
Provide me a better solution?

Cant install wordpress plugins

Today i ran into a problem. I was trying to install a plugin via the Wordpress enviroment and all of a sudden I got the following error: "an error occurred while installing IshYoBoy Multicorp Assets: unable to create directory ishyoboy-multicorp-assets."
I have already tried to give the files in wp-content the 777 permission but that didn't work. Installing the plugins locally works though (downloading the plugin and placing it in the destination folder). It feels like I have tried everything I know.
Simply append owner and group arguments to the synced_folder config in the Vagrantfile
,:owner=> 'www-data', :group=>'www-data'
Example
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise64"
config.vm.synced_folder "wp-root/", "/var/www",:owner=> 'www-data', :group=>'www-data'
config.vm.network "forwarded_port", guest: 80, host: 8000
end
Make sure that your web server has permission to write to that folder. Changing the permissions to 0777 may not solve the problem, and it's not a great way to go anyway.
If the folder is currently owned by "root" or some other user, try switching the owner to apache, www, or whatever your server uses for ownership using the chown command.

Nginx fails to create directories on Windows 10 with error: nginx: CreateFile()...failed

I need to find a way/setting to allow Nginx to run a .bat file that will create directories and files via a WINDOWS service; my OS is Windows 10.
Currently, our windows service fails to create directories and files with the following:
CreateFile()
"C:\someForlderName\build\distribution.\nginx/logs/error.log" failed
(3: The system cannot find the path specified)
Somehow Nginx doesn't have enough permissions to perform write-access operations like creating directories such as /logs/ and /temp/ within the /Nginx/ directory.
Anybody ran into this problem before?
I was facing the same problem, sharing the thing that worked for me.
Nginx is showing this error because... nginx didn't find the error.log file..
For that,
Go to you nginx folder where other folders like conf, docs, html etc are their as.
Create folder name logs, and in that folder create a file name error.logas.
see the right way in picture..
If your Nginx is at D:\nginx\nginx.exe, execute this to start nginx
D:\nginx\nginx.exe -c D:\nginx\conf\nginx.conf -p D:\nginx\
For Nginx on Windows, you need to execute nginx server related command from respective home directory where nginx configuration file is located.

Changing the nginx user when provisioning a Vagrant box with PuPHPet

I'm using Vagrant in order to produce a reusable development server and I'm using Puppet to provision it with a configuration generated with PuPHPet. It's a basic LEMP stack.
Everything is working fine however the nginx user is running as www-data and the synced folders are owned by the vagrant user. Because of this nginx can't write data to the /var/www directory which is causing my Laravel application to throw an exception.
I can manually change the ownership using chown however I'd like to just run nginx as the vagrant user and have that change in my configuration file.
What changes to the Puppet configuration do I need to make to make that happen?
PuPHPet is using the puppetlabs-nginx module which has an nginx::params class in it which in it's turn defines certain nginx config variables including $nx_daemon_user. That said it looks like in your PuPHPet generated manifest you'd want to replace
include nginx::params
with
class {'nginx::params':
nx_daemon_user => 'vagrant',
}

Error:No such file or directory when tried to access nginx.conf using path /opt/nginx/conf/

When i tried to configure the webserver through the path cd /opt/nginx/conf/ an error appears /opt/nginx/conf.Hope some one will have the answer here.Thank you
probably your config is under /etc/nginx, to check which directories nginx is using you can use the command whereis nginx

Resources