I've just installed and setup VVV with Vagrant and Virtual Box, everything at the base level is working perfectly.
I've tried adding a custom site, as per their example, but when I navigate to the custom sites' URL(vvvtest.dev) I get sent to the VVV dashboard instead of the WP install process for the new site.
I'm using vagrant-hostsupdater so the hosts file is getting populated for me as well as vagrant-triggers.
Any help would be greatly appreciated!
EDIT: I've noticed in my hosts file that vvvtest.dev is pointing to the same location(sim link?) as vvv and vvv.dev, see screenshot. Where have I gone wrong during config ?
My vvv-custom.yml file stored in the main folder (vagrant-local):
sites:
# The wordpress-default configuration provides a default installation of the
# latest version of WordPress.
wordpress-default:
repo: https://github.com/Varying-Vagrant-Vagrants/vvv-wordpress-default.git
hosts:
- local.wordpress.dev
# The wordpress-develop configuration is useful for contributing to WordPress.
wordpress-develop:
repo: https://github.com/Varying-Vagrant-Vagrants/vvv-wordpress-develop.git
hosts:
- src.wordpress-develop.dev
- build.wordpress-develop.dev
# Custom Install Test
vvvtest:
hosts:
- vvvtest.dev
# The following commented out site configuration will create a standard WordPress
# site in www/example-site/ available at http://my-example-site.dev.
#example-site:
# repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
# hosts:
# - my-example-site.dev
# The following commented out site configuration will create a environment useful
# for contributions to the WordPress meta team:
#wordpress-meta-environment:
# repo: https://github.com/WordPress/meta-environment.git
utilities:
core:
- memcached-admin
- opcache-status
- phpmyadmin
- webgrind
My nginx.conf file stored in www/vvvtest/provision:
server {
listen 80;
listen 443 ssl;
server_name vvvtest.dev;
root {vvv_path_to_site};
error_log {vvv_path_to_site}/log/error.log;
access_log {vvv_path_to_site}/log/access.log;
set $upstream {upstream};
include /etc/nginx/nginx-wp-common.conf;
}
My vvv-init.sh file, stored in www/vvvtest/provision
#!/usr/bin/env bash
# Add the site name to the hosts file
echo "127.0.0.1 ${VVV_SITE_NAME}.local # vvv-auto" >> "/etc/hosts"
# Make a database, if we don't already have one
echo -e "\nCreating database '${VVV_SITE_NAME}' (if it's not already there)"
mysql -u root --password=root -e "CREATE DATABASE IF NOT EXISTS ${VVV_SITE_NAME}"
mysql -u root --password=root -e "GRANT ALL PRIVILEGES ON ${VVV_SITE_NAME}.* TO wp#localhost IDENTIFIED BY 'wp';"
echo -e "\n DB operations done.\n\n"
# Nginx Logs
mkdir -p ${VVV_PATH_TO_SITE}/log
touch ${VVV_PATH_TO_SITE}/log/error.log
touch ${VVV_PATH_TO_SITE}/log/access.log
# Install and configure the latest stable version of WordPress
cd ${VVV_PATH_TO_SITE}
if ! $(wp core is-installed --allow-root); then
wp core download --path="${VVV_PATH_TO_SITE}" --allow-root
wp core config --dbname="${VVV_SITE_NAME}" --dbuser=wp --dbpass=wp --quiet --allow-root
wp core multisite-install --url="${VVV_SITE_NAME}.local" --quiet --title="${VVV_SITE_NAME}" --admin_name=admin --admin_email="admin#${VVV_SITE_NAME}.local" --admin_password="password" --allow-root
else
wp core update --allow-root
fi
Hosts File:
In your www/vvvtest/provision/nginx.conf file, maybe you can try to revise the directory of root to:
root {vvv_path_to_site}/public_html;
Hope it helps.
Related
I ma getting 403 request entity too large when I try to upload a file of more than 1 mb on elastic beanstalk.
I tried to add my configuration in the .platform/nginx/conf.d/proxy.conf file. here is the file content
client_max_body_size 200M;
I followed the advice here to configure the nginx reverse proxy to allow files larger than the default 1MB.
I tried to create a .config file in the .ebextenstions. file content look like this
files: "/etc/nginx/conf.d/proxy.conf" : mode: "000755" owner: root group: root content: | client_max_body_size 200M; commands: 01_reload_nginx: command: "service nginx reload"
Also tried everything mentioned on this answer here
I tried to access the Ec2 instance via terminal and manually add client_max_body_size 200M; in the etc/nginx/nginx.conf file. this worked but the problem is whenever we deploy the new version on beanstalk this will update the nginx configuration and have to follow the same instructions again after every deployment as Beanstalk also warn the same thing.enter image description here
I have a server set with NGINX: https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/
Recipe
Abridged basic setup
I have deployed WP in this directory: /var/www/blog.example.com/
/var/www and /var/www/blog.example.com/ does have nginx:nginx file/dir perms.
wp-config.php - 644
wp-content - 755
wp-content/plugins - 755
NGINX is running as nginx user.
I can browse in entire WordPress site including admin. However, when I want to install a new plugin or update I got always the message:
Installing plugin: iThemes Security (before Better WP Security) 7.9.1
Downloading the installation package from
https://downloads.wordpress.org/plugin/better-wp-security.7.9.1.zip…
Decompressing…
An error occurred while installing iThemes Security: Directory could not be created
What's I am wrong?
All libraries required according to https://make.wordpress.org/hosting/handbook/handbook/server-environment/ was installed.
When I try to upgrade a theme, for example, I got 200 code "OK" from a web server, but, I don't see anything in the error_log of NGINX.
Also, I've checked the php-fpm but I don't see any updating error.
php-fpm was running as an apache user.
I've switched the user into Nginx and It's solved. :D
It looks that the issue is the 'plugins' folder writing permissions. WP downloads the zip archive of the plugin then it decompresses it to the 'plugins' folder.
This article will help:
https://secure.wphackedhelp.com/blog/fix-file-and-folder-permissions-error-wordpress/
Just adding onto #sincorchetes answer, to those who need more specific instruction:
vim /etc/php-fpm.d/www.conf
I changed the lines
user = apache
group = apache
to
user = nginx
group = nginx
Then restarted the php-fpm and nginx service
systemctl restart php-fpm
systemctl restart nginx
I use nginx docker(https://github.com/jwilder/nginx-proxy), but find it no way to amend .htaccess as mentioned here(Nginx no-www to www and www to no-www). Could anyone tell me how to redirect no-www to www under the above jwilder/nginx-proxy.
This may be a little late but I found the solutions here to be too much faffing, so I created the adamkdean/redirect lightweight companion service for jwilder/nginx-proxy.
The example below simply shows HTTP but you can hook this up to HTTPS if you like using the letsencrypt-nginx-proxy companion service by JrCs.
For adamkdean/redirect, you simply provide two environment vars, one of the redirect location and one of the status code (which can be either 301, 302, 303, or 307) with the default being 307 (if you omit REDIRECT_STATUS_CODE).
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- 80:80
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
redirect:
image: adamkdean/redirect
environment:
- VIRTUAL_HOST=example.com
- REDIRECT_LOCATION="http://www.example.com"
- REDIRECT_STATUS_CODE=301
example:
image: example
environment:
- VIRTUAL_HOST=www.example.com
Find the repo here: https://github.com/adamkdean/redirect
You would need to:
git clone https://github.com/jwilder/nginx-proxy,
amend nginx.tmpl and
rebuild the nginx-proxy image yourself.
That way, you would generate a new nginx-proxy image which does include the directives you need.
You can add the redirect without changing the nginx.tmpl. There is the option to import further configuration files either directly under server { or in the default location location / {. See https://github.com/jwilder/nginx-proxy#per-virtual_host.
Create and mount a file /etc/nginx/vhost.d/your-website.com or /etc/nginx/vhost.d/your-website.com_location with the following content:
rewrite ^/(.*)$ http://www.your-website.com/$1 permanent;
Introduction
Unfortunately you did not specify your technical setup.
So i do have to make some assumptions.
Let's assume that you want to start a blog using a fully supported docker environment with following docker images:
nginx-proxy,
docker-gen,
letsencrypt,
ghost (blog software) and
mariaDB.
Therefore you registered a domain with the name personalblog.com.
You already set up an DNS A record to the IP address where your blog content will be hosted. So you have an A record for personalblog.com to that IP address and an A record for www.personalblog.com to that IP address.
Requirements
Please follow the instructions to setup your nginx-proxy with letsencrypt environment (you will find in these repositories a full instruction for setup):
https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion
After finishing the nginx-proxy setup for docker, please follow these instructions for setup your blog software with ghost and maria db:
https://github.com/LuisArteaga/docker-ghost-mariadb-letsencrypt
There might be a docker bug when pulling the latest image for ghost. So change in the docker-compose.yml ghost:latest to ghost:1.22.1
Redirect non-www to www for jwilder/nginx-proxy
In the nginx-proxy setup (described by #evertramos repository above) you specified in the .env file your Nginx File Path (Check out the line with NGINX_FILES_PATH=/path/to/your/nginx/data). With this you created a directory outside of the nginx docker container.
Step 1
cd /path/to/your/nginx/data/vhost.d/
sudo vim personalblog.com
Step 2
In the new file personalblog.com you add following line:
return 301 http://www.personalblog.com$request_uri;
Save the file with ESC and :wq
Step 3
Go to your path where your docker-compose.yml for nginx lies and do:
sudo docker-compose up -d --force-recreate
Notes
The file that you are creating under /path/to/your/nginx/data/vhost.d/ has to be the name of your domain. In this case you want to redirect from personalblog.com to www.personalblog.com, so the file name is personalblog.com. If you followed the instructions of the repositories above you will automatically redirected to https. So don't worry if you just redirect to http://www.personalblog.com.
Don't forget to update the variable VIRTUAL_HOST to have both the www and non-WW hostname:
VIRTUAL_HOST=www.target-host.com, target-host.com
First you need to clone git using: https://github.com/jwilder/nginx-proxy
Then amend it using nginx.tmpl and at last rebuild it using nginx-proxy image yourself.
I have an Nginx service that's configured to start automatically on my Windows 10; however, this morning, the service wouldn't start.
The error log says: nginx: [alert] could not open error log file: CreateFile() "C:\someForlderName\build\distribution\.\nginx/logs/error.log" failed (3: The system cannot find the path specified)
Looking at the path in the error log above, I do NOT have the /logs/ folder on my local system so it looks like Nginx doesn't have the proper permissions to create that folder?
I'm setup as an admin user and my service is set to Log On As - Local System Account
This only happens on Windows 10; but the service starts and works on
older Windows i.e 8.1
So does anyone know how to grant administrator's permissions to Nginx so that Nginx can create folders and files on Windows 10 ?
You need:
To install nginx/Windows, download the latest mainline version distribution (1.13.8), since the mainline branch of nginx contains all known fixes. Then unpack the distribution, go to the nginx-1.13.8 directory, and run nginx. Here is an example for the drive C: root directory: (Run cmd as administrator)
cd c:\
unzip nginx-1.13.8.zip
cd nginx-1.13.8
start nginx
Go to: http://localhost:80 -> test install
Goback to console cmd: "nginx -s stop"
Run for next time:
Config with file: "C:\nginx-1.13.8\conf\nginx.conf"
Open cmd as administrator
Run bash: "cd C:\nginx-1.13.8"
Run nginx with bash: "start nginx" . If you run with bash: "nginx", will get trouble for exit nginx.
And
nginx -s stop #fast shutdown
nginx -s quit #graceful shutdown
nginx -s reload #changing configuration, starting new worker processes with a new configuration, graceful shutdown of old worker processes
nginx -s reopen #re-opening log files
Under the directory that you run nginx.exe, try to create a directory named logs, and a file named error.log under log.
It should pass this error.
After downloading zip file, you have unzip.
Make sure that you dont have nested folder names. You have to copy your folder which has nginx.exe file in it, and paste it into C:/ folder.
While running commands, like nginx -s stop, make sure that current your working directory is same as the nginx.exe file.
enter image description here
Nginx start on default port 80, not 8080. Try localhost:80 on browser.
If you want to change port, open C:\nginx-1.16.1\conf\nginx.conf with text editor.
change port number what you want use default port.
server {
listen 80;
server_name localhost;
to:
server {
listen 8080;
server_name localhost;
I had a similar issue with starting the nginx server, but after looking at it closely and trying to run the command in different consoles, I realized it just a simple issue of a missing path.
How I solved it was to cd into the containing folder for the nginx.exe file (which actually contains error logs and all the necessary files) and then run the nginx command which started the server and fixed it for me.
I need to install Nginx with some modules on my virtual machine (Debian 7 x64). I use Vagrant and one recipe from Puphpet. Puphpet uses Hiera to configure Vagrant and Puppet installation way. By default in puphpet/config.yaml I have nginx section:
nginx:
install: '1'
settings:
default_vhost: 1
proxy_buffer_size: 128k
proxy_buffers: '4 256k'
upstreams: { }
vhosts:
rpfrz3ldtf65m:
proxy: ''
server_name: awesome.dev
server_aliases:
- www.awesome.dev
www_root: /var/www/awesome
listen_port: '80'
location: \.php$
index_files:
- index.html
- index.htm
- index.php
envvars:
- 'APP_ENV dev'
engine: php
client_max_body_size: 1m
ssl_cert: ''
ssl_key: ''
I need Nginx modules image_filter , so where could I place the correspond information in this config? I could place the Puppet manifect provided by puphpet configuring Nginx, but it's huge and too hard to understand.
Author of puphpet here.
From my understanding, Nginx needs to be compiled with your chosen modules, they cannot be enabled/disabled like Apache.
If the module you want is not installed in the Nginx package installed via puphpet, then that means it wasn't compiled in. You'll need to find another source that has that module compiled in, or compile Nginx yourself.
This is the Nginx Puppet module used in puphpet: https://github.com/jfryman/puppet-nginx/tree/v0.0.10/manifests/package