NGINX - /etc/nginx/conf.d is empty - nginx

I'm working with Nginx From Beginner to Pro. The book affirms that:
The /etc/nginx/conf.d folder contains two files, default.conf and
example_ssl.conf .
but when I open my /etc/nginx/conf.d then make the list command I have nothing but just some dots like .. . which appears and are impossible to handle -neither read or open. So I'm wondering what it happens and why I haven't my files appears in the directory. After having made some searches on web I have found nothing relevant to me.
Also it's impossible to create neither a folder or file in this directory.
Currently I have create an another folder and probably will use it to insert some custom configuration.

Today, I also fell into the same issue.
When I was trying to fetch this file using FileZilla, it was not showing up.
But then I logged in through Putty and ran the command
sudo nano /etc/nginx/conf.d
The file got opened up with all its contents.
I hope this helps others.
PS: we should not try to alter this file at beginner level.
I had to find it only to increase the hash_bucket_limit inside http object. (Because the length of my domain name regex was larger than default limit).

Related

Nginx - Custom configuration files location

I use Nginx with many domains. Some of these domains have custom configurations. I'm including these files inside the server blocks in the Nginx configurations.
For example:
server {
... some configurations things here...
include /var/somewhere/custom.conf;
etc.. etc..
}
The configuration files of Nginx are inside: /etc/nginx
To try and keep everything in one place and not have my custom configuration files all over the place I would like to place my custom configuration files inside /etc/nginx/some_directory
Can I create a sub directory inside /etc/nginx without it causing any issues with Nginx itself? I want to create /etc/nginx/some_directory/ and place my many custom configuration files inside it and include them.
I'm specifically asking this question because I don't want to break something on my production server.
If nginx doesn't know about a directory, it'll not touch it. You can verify that by greping against such pattern in nginx's codebase.
However, messing with a foreign folder structure might cause problems with permissions and ownership of the files, therefore either just use a pre-defined folders nginx prepared for you (/etc/nginx/sites-enabled and /etc/nginx/sites-available) which you can use with symlinks such as nginx itself does
# ls /etc/nginx/sites-enabled
default -> /etc/nginx/sites-available/default
# ls /etc/nginx/sites-available
default
otherwise you're getting into a situation what C/C++ programmers call an undefined behavior and there's no guarantee that what works now will work in the future / nginx doesn't change as well as the distro maintainers might mess with the folder structure and permissions for the packages in distro package manager.
Example:
Nginx might verify the full /etc/nginx tree's permissions and owners - if your folders/files don't match it might cause a warning or crash even. If it's installed by a package manager, it might cause issues when removing the package itself e.g. if the package manager attempts to remove only a known list of folders + afterwards the parent i.e. /etc/nginx by rmdir or similar. Situations you don't really want to get into and debug when you can use allowed folders or symlinks or your own folders that are not bound to an application or behavior except the one you define.

How to solve this error in moodle ? and setup in localhost?

Fatal error: $CFG->dataroot is not configured properly, directory does not exist or is not accessible! Exiting.
You need to check 'config.php' in your moodle installation files directory.
There you can find a line like below, which shows your directory name (it seems empty as per your error, you need to define path here) - in this directory/folder your moodle media uploads get store.
$CFG->dataroot = '/var/moodledata';
Moreover, after define this you will require to give Read,Write,Execute permissions to this folder.
(here '/var...' mentioned as Ubuntu directory structure, in localhost you need to mention respectively)

Uploads in Symfony's var directory not accessible

I'm trying to upload files into 'var' directory (successfully). But when I want to take this one file from 'var' I only can observe No route found for "GET /var/uploads/images/....
Structure:
- app
- bin
- src
- var
- cache
- logs
- uploads
- images
- vendor
- web
For saving my files I'm using: '%kernel.project_dir%/var/uploads/images'
For order to take file: '/var/uploads/images/' . $fileName;
Where're my mistake?
P.S. Moreover I try to use volume (I'm using docker) in my docker-compose file like this: - ./data/cabinet/uploads/images:/data/www/cabinet/var/uploads/images
And, unfortunately, no one file didn't copy to this directory. What's wrong?
Thank you!
Since the document root is pointing to the web directory, there's no possibility for path ../var to be accessible. Either store uploads inside the web directory or create a symlink inside it pointing to the var/data/uploads:
// since I don't know your path tree inside the container
// I assume whole application is installed inside /var/www/html
// and this is the default working directory
docker-compose exec YOUR_CONTAINER_NAME \
ln -rs /var/www/html/var/data web/var
Bear in mind that if you are using Apache webserver, the FollowSymLinks option has to be enabled, but most probably is.
As for the second question, most likely you mapped an invalid directory, I guess this should be:
// yet again I assume whole application is inside the /var/www/html
./data/cabinet/uploads/images:/var/www/html/data/cabinet/uploads/images
Is this some kind of production anyway? If it is not and this is merely a work-in-progress, then you rather should map your whole local directory as container volume. This is how it's usually done in dev mode, so the mapping would be:
.:/var/www/html

nginx - Failing to load images only, loading css and js

So I setup nginx and uwsgi using this tutorial: http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html
I finished the tutorial completely but for some reason only my images are not being loaded on the page when I run the command...
uwsgi --ini exchange_uwsgi.ini
where exchange_uwsgi.ini is my initialization file for specifying what socket I run on, wheres my project, wheres my virtualenv etc...
Just to re-iterate, the only things not showing up are my images and my images and css are all stored in one folder.
Any reason why this might happens?
Thanks
I fixed the problem.
Make sure to check the permissions on all of your static files. Only 2 images of mine were not loading and they were the only ones with incorrect permissions.
On Linux, first go to the folder with all your static files in the command window, type "ls -l" for list items with the long parameter so you can view permissions.
I set my permission on each file to -rw-rw-r--
Edit: In order to change permissions look into the command "chmod"

Wordpress Blank Install Page

I uploaded a freshly downloaded copy of Wordpress 4.2.2 here: http://www.onedayonemillion.com/test/ and all I get is a blank page.
There are no .htaccess or wp-config.php files in the root directory.
No database has been connected yet.
I tried the same in another directory (/dev/) and it did the same.
I have no plugins installed or activated.
This is a fresh copy.
I added an phpinfo file here: http://www.onedayonemillion.com/test/info.php
Why can't I even get the install page to show up?
I didn't understand why there is no wp-config.php in the directory, it would be good you post what is in the directory. Anyway, you can check items like (sometimes it is just that):
some files with no ending "?>" ending the file;
any require_once methods calling non-existing files
(you said no, but) wp-config has wrong or non-set definitions (user, database)
check permissions/ownership to the folder
Well, I know it can be lame, but I had problem with definition in WPLANG define,
so I put an
echo "<br> there is no error until here";
through the files untill I find that was missing a comma at the definition. If the phrase is displayed, your installation files untill that point are working out.
Your phpinfo says the display_errors is off.
modify your php.ini with this line:
display_errors = on
you should restart the server after modification.
you can only track the error only if the error reporting is on in the server

Resources