phpMyAdmin error on CentOS7 / nginx virtual box - nginx

I been spending the past several days building a 'simple' LEMP virtual machine for web development. I HAD phpMyAdmin 4.4 working fine using a symlink from /usr/share/phpMyAdmin -> www/site.com/pub_html/pma and a sites-available/sites-enabled configuration. However, I thought 'whats the point in having the symlink when i could just move the entire phpMyAdmin directory to my pub_html folder...". So I moved it, deleted the symlink and now PMA is not accessible via the browser! I am getting a Connection Timeout error in browser. I have restarted services nginx, php-fpm, mysqld, and have cleared cache in browser, restarted my VB.
If I move a directory that has been symlinked AND is essentially being used by server blocks in sites-enabled, do i have to REDO the sites-available/enabled configuration?
Any thoughts as to what the issue/problem might be? Thanks for help!

In the end it was a typo in my /etc/nginx/sites-enabled directory: i had a symlink for pma instead of pma.conf. i was looking for *.conf files in my nginx.conf file. stupid oversight.

Related

Permissions and performance issues using Windows 11 + WSL2 (Ubuntu), Docker Desktop & WordPress via docker-compose local environment

I am working on a project handed over by a previous developer which utilises docker desktop and a docker-compose.yml file to bring up a WordPress project on my Windows PC. This worked okay on my last PC (Windows 10), I've now upgraded to a new PC running on Windows 11.
The project worked fine with a non WSL version of docker, just using hyper-v and docker-compose with some mounted volumes to create the containers and code up a bespoke WordPress theme (running on roots/sage 8).
Since moving to Windows 11, the project has been almost unusable due to massively slow pagespeed (30 seconds minimum to load just about anything).
I tried to solve this by switching to WSL2. I followed tutorials from Microsoft & Docker to get WSL2 setup with Ubuntu.
I did a totally clean install of:
WSL2
Ubuntu
Docker Desktop
VS Code
My understanding is that adding the project files directly into Ubuntu is the best way to go as it should be a lot faster than trying to mount the files from Windows, so I setup SSH keys and cloned the repo into my /home/andy/ directory.
Running docker-compose up successfully fires up the website but I then get hit with loads of issues I never encountered while running the project via docker desktop without WSL2.
WordPress or the web user seems to be lacking permissions to write to the wp-content directory
-- Can't install any plugins
-- Can't upload media
VS code (launched via code . in the project directory) doesn't have permission to write to anywhere in wp-content
FileZilla is unable to create any folders within wp-content including in wp-content/uploads
I need to get this project working, I'm obviously not a docker or linux expert, I just need to get it fired up so I can continue coding with WordPress!
I've trawled through most pages of Google's search results for people having similar issues and I've done a fresh install of the WSL2/Docker setup multiple times after trying different things to get this to work but nothing is working.
I've tried:
adding to the docker-entrypoint.sh chown -R www-data:www-data /var/www/html
-- This was to try and give the www-data user ownership of everything mounted into the var/www/html directory, which appeared initially to help but broke other permissions, like Filezilla being able to write to wp-content
Ensured that all the directories/files in my project folder had the correct permissions for WordPress 755 for directories & 644 for files
-- Had no effect on the issue
Attempted to set 777 recursively on the entire project directory in Ubuntu
-- Still had issues with FileZilla & VS Code, and for some reason, when I did docker-compose up the permissions on wp-content reset themselves from 777 to 755
Added user:$USER within the wordpress part of the docker-compose.yml file, and then did USER=root docker-compose up
-- This appeared to give WordPress the permissions/access needed in order to write to wp-content as I could now download and install plugins, and upload media, but the entire backend of WordPress was very slow and I still couldn't save files with VS code, or download with FileZilla.
Attempted to take ownership of the /home/andy directory where my project files live via sudo chown -R andy /home/andy/
-- This allowed VS Code & FileZilla to both work as expected, saving files and downloading files from a remote server into Ubuntu via WSL2
With weird root user hacky solution + chown on the user directory, I appeared to have got everything "working", but wp-admin was so ridiculously slow, it was barely usable.
Another post I came across said that using .local to access the site was a bad idea since that could cause slow performance with docker, so I then changed the website url in my hosts file, and did a find and replace on the DB/Files to reflect the change, and now the backend of WordPress works fast, but appears to have permissions issues as lots of plugins are complaining about not having the correct permissions and I'm unable to download / install or even deactivate existing plugins.
I'm basically at a total loss at this point as for how to get this working. If anyone has any suggestions I'd be very grateful.
Thanks!

Will reinstalling nginx remove configs

I want to add a new module to nginx but its on production and deleting nginx configuration is not an option.
After a bit of research I noticed that I have to reinstall nginx in order to add a module to it.
So my question is, is it possible in any way to reinstall nginx (and executing the ./configure command without messing up the current nginx configuration?
All I need is to generate the .so file to copy it to the existing /usr/lib64/nginx/modules directory.

How to tell if nginx sites-available is enabled Ubuntu 20.04?

I'm not too familiar with how Nginx works, but a buddy of mine needed another AWS EC2 instance set up. I noticed it was doing a redirect with Nginx on the main instance and saw that sites-available and sites-enabled were being utilized.
The difference between mine and the main instance is that on AWS console, the sites-available .conf on main is highlighted blue and mine isn't. Does this mean mine is not fully enabled?
I get 0 errors when testing files and reloading nginx. Any help is appreciated.

nginx 1.8.1 works only with default root

I have Cent OS 6.6 with nginx 1.8.1 installed. It seems like if I change the root in the conf file to something other than the default '/usr/share/nginx' it gives an error 403 Permission denied. I have even given 777 permission to the other folder and files and it still doesn't work. I tried changing the user in nginx to 'apache', 'nginx' or'root' and that doesn't work either. I have disabled SELinux too. The folder I was trying to get it to work is '/var/www/'. Is there some enforcement in this version of nginx so it only works with '/usr/share/nginx' root?
The nginx worker process runs as 'apache'.
Even though I disabled SELinux by modifying the config file it was still enabled. I had to run the command 'setenforce Permissive' and it worked!!

Forbidden message when serving a sinatra local site using nginx passenger

I've followed the instructions for installing phusion passenger with nginx in ubuntu. I had some issues while installing since I use rvm and I had to install as root and the installer was failing to find rake so i temporarily chmoded /opt to be owned by my user and after installation I resetted ownership to root. I can see nginx welcome page but when I try to visit a sinatra app I get forbidden, the virtual host is pointed to the sinatra app public dir and the permissions for the whole app are 777.
Try Passenger 3. It automatically detects most permission problems and tells you how to fix them.
If this is for a production system, you really don't need the flexibility of RVM as you should be using a single stable version of Ruby and Rails for Phusion. Install the version you need, using Aptitude if that version is available, and be done with it.
Because this is the page that Google brought me to for my issue, which isn't a Passenger issue, but a Nginx reverse-proxy issue, you need to add the line
disable :protection
somewhere in your sinatra app. I have mine at the very end, outside any method (in global scope).
Well my mistake was not using rvmsudo to install nginx with passenger, instructions here: http://rvm.io/integration/passenger/.

Resources