nginx doesn't follow symlinks with www-data user - nginx

I have created a folder to the default server at /var/www/default and everything works as expected.
Inside that folder I made a symlink to ~/WebstormProjects/my-project, using the common ln -s.
It worked for a while, and the last time I updated using apt-get, nginx doesn't follow anymore the symbolic link, which gives me a 404 error, not even listing the symlinks as it used to do.
Tried using the disable_symlinks directive, setting it to off, and nothing happened. Also followed the steps in this link and still nothing. Also added myself to the www-data user, nothing.
But if I edit nginx.conf by changing the user directive to my own user and restarting the server does work, but I know that's a very bad practice and some day in the future it will not allow PHP-FPM to work.
So, what can I do to make nginx follow symlinks, without changing the owner of my source directories? BTW, I'm using Ubuntu 14.04.3 and nginx 1.4.6 installed via package manager.

It was just a problem with permissions:
chmod 755 /home
chmod 755 /home/user
Got previous commands from this answer.

Related

phpMyAdmin errors while accessing config.inc.php and blowfish_secret.inc.php

i'm running phpMyAdmin 4.6.6deb5 on the following configuration:
Ubuntu Server 18.04.3
nginx/1.17.9
7.2.24-0ubuntu0.18.04.3
phpMyAdmin seems to work, but there's this red error message that says something about the blowfish secret. Somehow there's no way to get rid of it. The error-log contains the following entries:
2020/03/22 21:46:30 [error] 26664#26664: *53 FastCGI sent in stderr: "PHP message: phpmyadmin: Failed to load /var/lib/phpmyadmin/blowfish_secret.inc.php Check group www-data has read access and open_basedir restrictions.
PHP message: phpmyadmin: Failed to load /var/lib/phpmyadmin/config.inc.php Check group www-data has read access and open_basedir restrictions" while reading response header from upstream, client: 87.147.18.48, server: ***, request: "GET /phpmyadmin/js/get_image.js.php?theme=pmahomme&v=4.6.6deb5 HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "***
Both, the folder and the files, are assigned to www-data. I've also assigned the following permissions:
# chmod 755 /var/lib/phpmyadmin
# chmod 664 /var/lib/phpmyadmin/blowfish_secret.inc.php
# chmod 664 /var/lib/phpmyadmin/config.inc.php
Doesn't work...
What seems strange to me is the fact that the config.inc.php is empty and the blowfish_seceret.inc.php looks like this:
<?php
$cfg['blowfish_secret'] = 'j(<purKyJl>5D]yzlPoKFLNfH9es6.-T';
It seems like both files are broken. Could anybody tell me where I can find right files? I know that there are several config.inc.php files in different folders, some of them including the line for the blowfish_secret, but I don't know which of them is the right one to copy to /var/lib/phpmyadmin.
I've found similar issues while searchig on stackoverflow and other forums, but none of the suggested solutions worked for me.
Thanks in advance
Best Regards, Boris
There are a couple of odd things about your setup, one of which is that package managers would usually put configuration files in etc/phpmyadmin, not /var/lib/phpmyadmin. In addition, version 4.6.6 is quite old.
If you want to continue to troubleshoot your existing installation, I suggest you start looking in to whether there are any open _basedir restrictions. Look at the output of phpinfo().
Create a new text file in your webserver root directory. You can call it whatever you'd like, such as phpinfo.php. The text file should contain
<?php
phpinfo();
Load that up in your browser and search the output for open_basedir. That will show what you have configured, and also near the top there's a section that will tell you which configuration files are being read, so you can start guessing where to fix it if there is a misconfiguration.
Upgrading
If your PHP and MySQL versions will support it (and PHP 7.2 will, so you are probably okay), I suggest installing the recent version from the phpMyAdmin PPA. You should first remove what you can on your local system of the existing phpMyAdmin package, including the /var/lib/phpmyadmin and /etc/phpmyadmin folders (the usual disclaimer about making a backup first applies even though none of this should be destructive). You may wish to save your configuration file config.inc.php if you've made customizations that you want to keep.
These should be compatible and updated.
Easy automatic install
Probably you only need two lines to add the PPA, then you can search for 'phpmyadmin' with your favorite package managing tool such as aptitude:
sudo add-apt-repository ppa:phpmyadmin/ppa
sudo apt-get update
Manual install
If your system doesn't have apt-repository or something else goes wrong, there are manual instructions there, which are basically this:
You probably have to add the PPA as an apt source, which you can do with
sudo echo "deb http://ppa.launchpad.net/phpmyadmin/ppa/ubuntu bionic main" > /etc/apt/sources.list.d/phpmyadmin.list
Try to update apt: apt-get update. You'll probably get a key error, which we expect because you don't have the proper key to verify downloads yet. When you get the error, note the key ID.
Retrieve the key: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 2EA3055293CB3F45 (at the moment, that is the key that I needed, but that could change, so it's better to copy and paste it from the error message and substitute that in this command).
Finally, you can update the package list again with apt-get update then install the phpmyadmin package with your favorite apt-flavored tool.

Where is server.conf file kept openCPU ubuntu

Sorry if this is answered elsewhere, or requires a trick.
I have installed openCPU on an ubuntu xenial-16.04 instance. I'd like to lengthen the timelimit.post value as instructed in the /etc/opencpu/server.conf file. Trouble is I can't find it.
ubuntu#ip-x-x-x-x:/usr/lib/opencpu$ ls -a
. .. library rapache scripts
Maybe please check again to see if you don't find /etc/opencpu/server.conf in the expected directory - i.e. because, as above in your output of ls -la /etc/opencpu/, the server.conf file is listed being there. Note though the owner is root so take that into account when you try to open+edit the file.

I deleted 'www-data' user, how can I rebuild a same one?

I edited my /etc/passwd and /etc/group file without backups and found the user www-data I thought it is useless, then deleted it from these two files.
When I tried to start my Nginx service, I got a failure whose log shows nginx using the www-data user to produce workers!
Was the user created by Nginx when I installed it or It was there since the big bang (I mean is it inherent user)?
Should I recreate the user and give some permissions to it (although I have no idea what permissions it needs), or just reinstall Nginx?
Thank you!
What OS are you using? On most linux user www-data is by default available with UID/GUID 33. In file /etc/passwd in Ubuntu and Debian you shoud have:
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
and in file /etc/group:
www-data:x:33:
Adding this two entries should be enough.
But of course you can use nginx as another user, just edit nginx.conf file. This is usefull sometimes when you have nginx for just for one website.

Installing Symfony 2 on Fedora 15

I've got a problem when i try to install Symfony 2:
I extract the content of the tgz file into var/www/html directory and then i go on http://127.0.0.1/symfony/web/config.php and it says that i need to change the permissions of app/cache/* and app/logs/*. The problem is that I tried all the solutions in the doc
Which solutions exactly did you try? Did you chmod those folders?
If your web server and command line user are different, that can also cause problems with those two folders. Check the docs for their umask solution and see if that helps.
I had the same problem and SELinux was responsible.
To figure out if SELinux is the source of your problem, turn it off by typing: setenforce Permissive on the command line.
If the script works, then you have to configure SELinux properly.

Wordpress Install on OS X Snow-Leopard under Sites/public for use with capistrano

I would like to put my local OS X wordpress site in my ~users/Sites/public directory, instead of the ~users/Sites so i can properly setup a capistrano deployment.
When i try this i can visit the site locally by visiting http://localhost/public and everything looks and works great but if i ever try to go to http://localhost/public/wp-admin to administer my local copy of wordpress it tries to redirect me back to http://localhost/wp-admin which doesn't exist.
Do you know how I might be able to work around this problem?
Make a symlink. In the terminal:
cd /Library/WebServer/Documents/
sudo ln -s ~/Sites/public/wp-admin
Then type your user password when prompted.
Changing your DocumentRoot in your Apache config would probably be a good place to start.

Resources