Nginx Update writes to /usr/share/nginx/html/index.html files - nginx

I did a yum update on my Development server and it updated Nginx 1.12.2.3 to Nginx 1.16.1.1. Also in the process it wrote to the index.html file.
This is of concern as if updates are run on a production server it could cause problems in that it could make the website crash as nginx appear to be writing to the public folder.
Here is how the /usr/share/nginx/html looks before the yum update versus after.
-rw-r--r-- 1 root root 2811 May 10 2019 poweredby.png
-rw-r--r-- 1 root root 368 May 10 2019 nginx-logo.png
-rw-r--r-- 1 root root 3700 May 10 2019 index.html
-rw-r--r-- 1 root root 3693 May 10 2019 50x.html
-rw-r--r-- 1 root root 3650 May 10 2019 404.html
Here is how it looks after the YUM update and reboot.
lrwxrwxrwx 1 root root 20 Jan 24 18:28 en-US -> ../../doc/HTML/en-US
lrwxrwxrwx 1 root root 18 Jan 24 18:28 img -> ../../doc/HTML/img
drwxr-xr-x 2 root root 26 Jan 24 18:28 icons
lrwxrwxrwx 1 root root 14 Jan 24 18:28 poweredby.png -> nginx-logo.png
lrwxrwxrwx 1 root root 25 Jan 24 18:28 index.html -> ../../doc/HTML/index.html
So the question is why is YUM/NGINX writing files to the public folder? As I said this is a concern in that it could bring the whole website down. Any help, thoughts or suggestions would be welcome.
Regards,
Patrick

Related

Which user should own the directory where lives the website?

I have nginx running with a master process as root and worker process as www-data.
Which user should own the root dirctory of the website (/var/www/html), and what permission (rwx) should the directory and its content have ?
You should have below permission for root directory.
-rw-r--r-- 1 root root 612 Mar 27 2018 xyz.html
-rw-r--r-- 1 root root 21 Nov 27 2019 phpinfo.php

Can't upload theme to wordpress - AWS Linux

I've got wordpress running on a AWS Linux instance.
I can create posts.
I can upload images.
But I can't upload themes.
Having messed about with the permissions this is where it currently stands:
-rwxr-xr-x 1 apache apache 418 Sep 25 2013 index.php
-rwxr-xr-x 1 apache apache 19935 Jan 2 2017 license.txt
-rwxr-xr-x 1 apache apache 7413 Dec 12 2016 readme.html
-rwxr-xr-x 1 apache apache 5447 Sep 27 2016 wp-activate.php
drwxr-sr-x 9 apache apache 4096 Jun 8 14:29 wp-admin
-rwxr-xr-x 1 apache apache 364 Dec 19 2015 wp-blog-header.php
-rwxr-xr-x 1 apache apache 1627 Aug 29 2016 wp-comments-post.php
-rwxr-xr-x 1 apache apache 2825 Jul 27 21:21 wp-config.php
drwxr-sr-x 5 apache apache 4096 Jul 28 11:53 wp-content
-rwxr-xr-x 1 apache apache 3286 May 24 2015 wp-cron.php
drwxr-sr-x 18 apache apache 12288 Jun 8 14:29 wp-includes
-rwxr-xr-x 1 apache apache 2422 Nov 21 2016 wp-links-opml.php
-rwxr-xr-x 1 apache apache 3301 Oct 25 2016 wp-load.php
-rwxr-xr-x 1 apache apache 34327 May 12 17:12 wp-login.php
-rwxr-xr-x 1 apache apache 8048 Jan 11 2017 wp-mail.php
-rwxr-xr-x 1 apache apache 16200 Apr 6 18:01 wp-settings.php
-rwxr-xr-x 1 apache apache 29924 Jan 24 2017 wp-signup.php
-rwxr-xr-x 1 apache apache 4513 Oct 14 2016 wp-trackback.php
-rwxr-xr-x 1 apache apache 3065 Aug 31 2016 xmlrpc.php
Any help greatly appreciated. Am I missing something obvious?
You need to check the permissions for the themes folder inside wp-content folder.
Try running the following commands if it's CentOS:
Changes ownership to Apache user and group
chowm -R apache:apache /path-to-wp/wp-content/
Change permissions and add setguid
cd /path-to-wp/wp-content/
find . -type d -exec chmod 2775 {} \;
find . -type f -exec chmod 664 {} \;
This should hopefully resolve the file permissions and fix the uploads.

How to set permissions for RabbitMQ directory to create new files?

I would like to move the RABBITMQ_BASE files to "/opt/rabbitmq"
I've attempted the following, but it appears that I'm making a mistake somewhere:
(while logged in as root)
mkdir -p /opt/rabbitmq
sudo chown -R rabbitmq:rabbitmq /opt/rabbitmq
sudo chmod 766 -R /opt/rabbitmq
here is the contents of my rabbitmq-env.conf
RABBITMQ_BASE=/opt/rabbitmq
export RABBITMQ_NODENAME=rabbit#localhost
export RABBITMQ_NODE_IP_ADDRESS=127.0.0.1
export ERL_EPMD_ADDRESS=127.0.0.1
export RABBITMQ_MNESIA_BASE=/opt/rabbitmq/MNESIA
I've checked the logs in /var/log/rabbitmq/startup_log:
BOOT FAILED
===========
Error description:
{error,{cannot_create_mnesia_dir,"/opt/rabbitmq/MNESIA/rabbit#localhost/",
eacces}}
Log files (may contain more information):
/var/log/rabbitmq/rabbit#localhost.log
/var/log/rabbitmq/rabbit#localhost-sasl.log
Stack trace:
[{rabbit_mnesia,ensure_mnesia_dir,0,
[{file,"src/rabbit_mnesia.erl"},{line,505}]},
{rabbit_node_monitor,prepare_cluster_status_files,0,
[{file,"src/rabbit_node_monitor.erl"},{line,101}]},
{rabbit,'-boot/0-fun-0-',0,[{file,"src/rabbit.erl"},{line,270}]},
{rabbit,start_it,1,[{file,"src/rabbit.erl"},{line,403}]},
{init,start_it,1,[]},
{init,start_em,1,[]}]
{"init terminating in do_boot",{error,{cannot_create_mnesia_dir,"/opt/rabbitmq/MNESIA/rabbit#localhost/",eacces}}}
The "/opt" directory is owned by root, but the permissions for the other directories are as follows:
ubuntu root#/opt $ ls -lah
total 48K
drwx------ 10 700 root 4.0K Jul 14 12:42 .
drwx------ 5 700 root 4.0K Jul 14 10:39 ..
drwx------ 13 700 root 4.0K Jul 12 10:16 anaconda
drwx------ 4 700 root 4.0K Jul 12 09:28 data
drwx------ 3 700 root 4.0K Jul 12 10:38 legacy
drwx------ 2 700 root 12K Jul 14 12:45 logs
drwx------ 3 700 root 4.0K Jul 12 09:47 mongodb
drwxrw-rw- 4 rabbitmq rabbitmq 4.0K Jul 14 13:05 rabbitmq
The solution which works for me is to disable SELINUX

Wordpress is adding -1.jpg to all my images. Now they are broken

I've inherited a slightly older Wordpress blog and I updated it, manuallyto version 4.5.3. It has broken all my images.
The path to an example missing image is:
/blog/wp-content/uploads/2014/10/tumblr_n85n0vdFyb1qzj0rpo1_1280-1.jpg
Here's the whats in that folder:
-rw-rw-r-- 1 forge forge 7100 Feb 26 15:32 tumblr_n85n0vdFyb1qzj0rpo1_12801-150x150.jpg
-rw-rw-r-- 1 forge forge 22757 Feb 26 15:32 tumblr_n85n0vdFyb1qzj0rpo1_12801-300x300.jpg
-rw-rw-r-- 1 forge forge 6687 Feb 25 18:21 tumblr_n85n0vdFyb1qzj0rpo1_1280-150x150.jpg
-rw-rw-r-- 1 forge forge 95613 Feb 26 15:32 tumblr_n85n0vdFyb1qzj0rpo1_12801.jpg
-rw-rw-r-- 1 forge forge 22153 Feb 25 18:21 tumblr_n85n0vdFyb1qzj0rpo1_1280-300x300.jpg
-rw-rw-r-- 1 forge forge 75944 Feb 25 18:21 tumblr_n85n0vdFyb1qzj0rpo1_1280-624x624.jpg
-rw-rw-r-- 1 forge forge 95613 Feb 25 18:21 tumblr_n85n0vdFyb1qzj0rpo1_1280.jpg
AFAIK - There should only be 1 image in that folder, I'm not sure at what stage the rest appeared.
Anyone any suggestions on how to fix this? I'm thinking its a wordpress setting? If not I'll need to maybe do a rewrite using nginx to get things working again?
In the end I found the code that generates the src's for the images and wrote a reg'ex to remove the offending "-1" from the URLs. Not an ideal solution but its got me by for now.

Permissions in wordpress running on Cent OS VPS - unable to update theme/plugin/wordpress

I am running wordpress 4.0 on Cent OS powered VPS. The installation runs smoothly, in my admin dashboard I see updates for wordpress/plugins/themes .I am facing the following errors when I try to upgrade them from dasboard
Updating Wordpress to 4.1 from 4.0
Update WordPress
Downloading update from https://downloads.wordpress.org/release/wordpress-4.1-new-bundled.zip…
Unpacking the update…
Could not create directory.
Installation Failed
Updating Plugins
Update Plugin
Downloading update from https://downloads.wordpress.org/plugin/google-sitemap-plugin.2.9.5.zip…
Unpacking the update…
Could not create directory.
Updating Themes
Updating Theme Twenty Fourteen (1/1)
Downloading update from https://downloads.wordpress.org/theme/twentyfourteen.1.3.zip…
Unpacking the update…
An error occurred while updating Twenty Fourteen: Could not create directory.
All updates have been completed.
I know I am messing with the file permissions, I have tried setting the permissions for the files as well. I tried assigning them to various groups/users like apache,root and nginx.
These are the current file permissions for my wordpress directory.
-rwxr-xr-x 1 apache apache 3070 Jan 2 10:59 wp-config.php
drwxr-xr-x 12 apache apache 4096 Jan 1 23:31 wp-includes
drwxrwxrwx 6 apache apache 4096 Jan 1 22:37 wp-content
drwxr-xr-x 9 apache apache 4096 Jan 1 22:31 wp-admin
-rwxr-xr-x 1 apache apache 435 Jan 1 22:25 index.php
-rwxr-xr-x 1 apache apache 19930 Jan 1 22:25 license.txt
-rwxr-xr-x 1 apache apache 7290 Jan 1 22:25 readme.html
-rwxr-xr-x 1 apache apache 3824 Jan 1 22:25 sitemap.backup.xml
-rwxr-xr-x 1 apache apache 5082 Jan 1 22:25 wp-activate.php
-rwxr-xr-x 1 apache apache 289 Jan 1 22:25 wp-blog-header.php
-rwxr-xr-x 1 apache apache 5110 Jan 1 22:25 wp-comments-post.php
-rwxr-xr-x 1 apache apache 2826 Jan 1 22:25 wp-config-sample.php
-rwxr-xr-x 1 apache apache 3071 Jan 1 22:25 wp-cron.php
-rwxr-xr-x 1 apache apache 2460 Jan 1 22:25 wp-links-opml.php
-rwxr-xr-x 1 apache apache 2787 Jan 1 22:25 wp-load.php
-rwxr-xr-x 1 apache apache 34185 Jan 1 22:25 wp-login.php
-rwxr-xr-x 1 apache apache 8512 Jan 1 22:25 wp-mail.php
-rwxr-xr-x 1 apache apache 11489 Jan 1 22:25 wp-settings.php
-rwxr-xr-x 1 apache apache 27005 Jan 1 22:25 wp-signup.php
-rwxr-xr-x 1 apache apache 4153 Jan 1 22:25 wp-trackback.php
-rwxr-xr-x 1 apache apache 3132 Jan 1 22:25 xmlrpc.php
Please guide me for suitable permissions.
Having the same issue... Did you try disabling all your plugins? Also you could try to change your permission to 777

Resources