Finding 'Nginx.conf' - wordpress

I recently started using vagrant and Virtualbox to run my Wordpress website. Today I ran into a problem. I was trying to import a theme and this happened.
413 Request Entity Too Large --- nginx/1.6.2 (Ubuntu).
I think that I know how to solve this, but for that i need to have access to the nginx.conf file. How do I access this where do I find it?
I' m using a mac.

you would need to login into the VM - you can do vagrant ssh to do so.
Once on the VM, you would need to edit your nginx.conf file as sudo (nginx.conf file is generally located in the directory /usr/local/nginx/conf, /etc/nginx, or /usr/local/etc/nginx on your VM depending how the installation was done) so sudo vi nginx.conf from the correct directory and you can make the change.
make sure to restart nginx after you made the change sudo /etc/init.d/nginx restart from the VM or even restart the VM if you make many changed vagrant reload from the host and you'll be ok

Related

Plugin upload error on wordpress hosted on AWS linux 2 (EC2 instance) connected with AWS RDS database

I am trying to upload plugin and theme on EC2 instance running on AWS Linux 2 connected with AWS RDB instance (MySQL). I exactly followed these steps presented by AWS.
Creating a MySQL Database with RDS: Configure the RDS database to allow access to specific entities.
Creating an EC2 Instance: Create an EC2 instance to run your WordPress site.
Configuring Your RDS Database: Configure the RDS database to allow access to specific entities.
Configuring WordPress on EC2: Install the WordPress application and dependencies on the EC2 instance.
Reference: AWS LINK FOR TUTORIAL
However, I am not able to upload plugin or theme, it shows this error:
I tried to fix this error using various recommendation, but unable to fix it. The file size in media library is only 2 Mb.
1.wpbeginner
I am unable to find .htaccess or php.ini file on wordpress as recommended by wpbeginner.
2.wpkube
I tried to create new files (.htaccess and php.ini) recommended here and uploaded at this directory: /var/www/html
This doesn't help to increase Maximum upload file size.
Could someone please help to resolve this issue?
you can edit the file in amazon linux -
vim /etc/php.ini
for upload max size to 100M
after you must restart apache and php
so
# sudo systemctl restart php-fpm
then you can check your phpinfo
first step open the php.ini file
sudo vim /etc/php.ini
edit to : max file size - 100M
and
post max size to 100M
save and exit
then
restart httpd and php-fpm
sudo systemctl restart php-fpm
sudo systemctl restart httpd
now check for phpinfo output

nginx config does not update after reload

following this tutorial :
https://www.digitalocean.com/community/tutorials/how-to-redirect-www-to-non-www-with-nginx-on-centos-7
I modified my config file /etc/nginx/sites-available/domainName by adding on the last row :
return 301 $scheme://www.example.com$request_uri;
Then I launched :
sudo systemctl restart nginx
It works well. Then I tried to modify www.example.com by my domain name and I launched again ;
sudo systemctl restart nginx
but it doesn't work, I'm still redirecting to example.com
I checked the log files, sudo nginx -t etc and everything looks good.
Do you have an idea of the problem?
Thanks
Try clearing the DNS cache in your pc, browser, and router.
If you're using Windows to run a Linux server in a virtual box, you can run the ipconfig /displaydns command to see the time of cache to live.

Engintron: Nginx couldn't start

I have a Cpanel/WHM server with Nginx installed as reverse proxy (with default Nginx manager), so i tried to replace Nginx with Engintron.
I installed Engintron and uninstalled Nginx via Cpanel Nginx manager.
As a result i got website not working and Nginx couldn't start (status from WHM Engintron page), so i should reinstall Nginx?
I don't know if Engintron contains already Nginx or not
I tried to reinstall Nginx and website work again, but i don't know if Engintron is serving the website or Nginx
Engintron contains nginx installation within their script. So if you install only engintron, it will be default instead nginx in reverse proxy mode with apache.
You can check your nginx installed configuration file location by
sudo nginx -t
(it will show location of configuration file along with testing the same).
See if the nginx configuration file matches the engintron configuration file or not. If you are confused here also then run
$ sudo nginx -T
this will dump the output of configuration file which you may tally with Engintron config file.
Last option would be to uninstall both the nginx and make a clean installation of Engintron.
Try to run these commands first:
/usr/sbin/nginx -s stop
/usr/local/cpanel/scripts/restartsrv_nginx start
If the problem still exists, Uninstall Nginx and all Ruby packages from EasyApache via WHM and reinstall Nginx again.

File not found error from nginx on a virtual machine where /var/www/ is mounted from host file structure

I am trying to set up a rather complex development environment as a virtual Ubuntu 12.04 server.
In order that I can edit files and immediately see the change at the refresh of the page as you would expect with a normal local development situation, I have the php source code on the host operating system (mint 14) in ~/www/site1 which I have added as a persistent shared folder to virtualbox and then mount on the virtual machine
mount -t vboxsf site1 /var/www
if I ls /var/www -la I see all the php files but when I try to access the virtual machine from the browser, I get File not found errors on the page and the error.log for the subdomain reports FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream". The exception is the subdomain phpmyadmin.virtualmachine which loads up perfectly so I know that nginx is serving the correct file structure for the requested subdomain.
As a test I created a subdomain info.virtualmachine which points to /var/test and the index.php is the simplest phpinfo() and this works so I can only presume that nginx is not reading the mounted vboxsf file structure /var/www correctly as all "local" files on the guest OS are viewable.
Nginx has been configured to run as root as have all other services. Is this a known bug with nginx or something that I need to configure to allow nginx to see the mounted vboxsf share?
I found the answer to this and it turned out to be due to file permissions and my unfamiliarity of how php-fpm works.
For starters, I enabled the root user in the virtual server and using supervisord to control the daemons, I set them all to run as root. The parent process for php-fpm runs as root but all child processes were running as www-data. Mounting the share as root caused the folder to be unavailable to php-fpm's child processes which caused nginx to throw file not found errors and because of the way the vboxsf works, I was unable to chown or chmod the share.
I got around this issue by adding the share to /etc/fstab with the following command :
sharename /var/www vboxsf rw,uid=33,gid=33 0 0
this allowed the share to be mounted under the www-data user giving read permissions to www-data.

nginx virtual host - fail when restart with no error

I have several subdomains running on nginx, and when i added next one, there was a problem with the same name of subdomain i removed.
I'm not shure that config were worked in the past. This is what i have found on serwer.
For now there is no possibility to restart nginx with virtual hosts, becouse it's failed.
config tests is ok,
without vh's it is restarting well,
nginx.conf test is ok,
logs are clear
nginx config is placed in project and /etc/nginx is pointing to that folder
I have add that exaple vh and it is crushing event with it.
What else can i check, what may cause such a problem?
I have found solution. Nginx could not start after stop, becouse ports 80 and 433 were busy by... nginx. Anyway
netstat -tulpn
shown what process are runing on particular ports.
I killed these processes with commands:
sudo fuser -k 80/tcp and fuser -k 433/tcp
and after that
sudo service nginx start
just worked.
Config files are fine, and test pass, logs where clear and nginx command show whats wrong

Resources