Hi,
Actually i have one site and two servers in Nginx conf file.
The first:
server {
listen 80 default;
server_name localhost;
access_log off;
rewrite ^ https://$http_host$request_uri? permanent; # force redirect http to https
}
The second
server {
listen 443 ssl;
server_name localhost;
ssl on;
ssl_certificate /etc/nginx/certificates/test.crt;
ssl_certificate_key /etc/nginx/certificates/test.key;
access_log /home/collecte.log;
root /var/www;
location / {
index index.php index.html index.htm;
}
location ~ \.php$ {
if ( $request ~* myString){
access_log off;
# access_log /home/collecte2.log;
}
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name;
include fastcgi_params;
}
location ~* \.(ico|css|js|gif|jpg|jpeg|png)$ {
expires 1d;
add_header Pragma public;
add_header Cache-Control "public";
}
}
The idea is to separate requests in two files. Like in the second server i disabled the log for same requests and i want to save them in another access_log file.
I tried access_log /home/collecte2.log;
but it doesn’t work.
Does anyone have any idea if i can duplicate the server with same configuration or with a different server name? How can i create two log files that receive a specific requests
Best regards, Nizar.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
After updating your configuration files did you restart your nginx service so the change could take effect?
service nginx restart