I am using default installation of Valet (https://laravel.com/docs/5.4/valet).
I have small experience with nginx, therefore I can't locate where should I store envvars for Valet.
For apache it would be quite easy - /etc/apache2/envvars
As a temporary solution on PHP, index.php, I use putenv('APP_ENV=dev'); but I would like to do this globally without touching index file.
Thanks.
Since I find this post when I am looking for an answer, it will be easier for me if I leave a note for my self here.
Since I installed nginx using brew, nginx config is located in /usr/local/etc/nginx, and environment variables are already set in fastcgi_params file.
Append to file
/usr/local/etc/nginx/fastcgi_params
a new line, for example
fastcgi_param APP_ENV dev;
If you don't want to set this environment variable globally, it can be overwritten for each site config in ~/.valet/Nginx/site.dev between location ~ \.php$ { closure.
Related
I'm trying to get my static files accessible so that I can load them with Flask.
ex: https://example.com/static/render.css
I've included this in the https part of my site:
location /static/ {
autoindex on;
alias /root/site/static;
}
But it just returns a 403 always.
The directory is correct and all, I've also ran the chown -R /root/site/static/ command. Idk what's the issue.
Nginx is definitely doing something with the data though, as all other extensions just reply a badgateway.
I decided to just write my CSS inline.
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.
I'm trying to configure nginx vhost for application and stucked.
App is in directory /site/verb
At this moment app have this kind of links and it is working:
http://example.com/verb/lt.php?some_args=some_args&some_args?some_args
What I need? I need add another link for my clients like below:
http://example.com/v/lt.php?some_args=some_args&some_args?some_args
It is only change from /verb to /v but I want to handle both (for compatibility reasons) with all arguments after .php extension.
Is it possible in nginx config? (I want to avoid creating symlinks in directory).
I tried symlinks but it is not good solution.
Simply, I want to achieve same thing of apache vhosts: Set Application_ENV via virtual host config and read this in PHP for nginx. How to do that?
One way to do it is use fastcgi_param as answered here and here.
I prefered another method. Since I'm using GIT as my VCS:
I created a file in the root of my project named it "env.conf",
which contains only 1 string ("production", "development", etc) which is the environment name
Ignored this file in .gitignore.
Read the file and check the value as the first thing in my application starting point.
I need to use access_log for some automation purpose.
After sometime access_logs are coming with date and time, i want to keep it with the name access_log only.
I have given the name in squid.conf but that is not working for me.
please suggest.
First, check your Squid configuration file and make sure there is no logfile_rotate parameter specified.
Then, check your operating system's logrotate.d folder for a configuration file directing it to rotate Squid's configuration file, and either remove the file completely, or rename it so it has a ".disabled" extension (may not work on all distributions).
On CentOS the logrotate configuration can be found at /etc/logrotate.d/squid.