Hello. I have a development ubuntu server with Nginx 1.14.0. which is running a site dev.mysite.com under authentication. To see the site you must enter user name and pass.
This is my sites-enabled conf file:
upstream fastcgi_backend {
server 127.0.0.1:9000;
}
#server {
# listen 80;
# server_name dev.mysite.com;
# return 301 https://dev.mysite.com$request_uri;
#}
server {
listen 80 default_server;
server_name dev.mysite.com; # dev.mysite.com;
root /home/wpaper/public_html;
#check http_x_forwarded_proto value that comes from load balancer
set $my_http "http";
set $my_ssl "off";
set $my_port "80";
if ($http_x_forwarded_proto = "https") {
set $my_http "https";
set $my_ssl "on";
set $my_port "443";
}
#cut off port from url
port_in_redirect off;
#setup log files
access_log /home/wpaper/www_logs/wpaper.access.log;
error_log /home/wpaper/www_logs/wpaper.error.log;
include includes/blocks.conf;
# Include Security rules for Mageto
include includes/security.conf;
# Tell browsers that website should olways be accessible via HTTPS
# add_header Strict-Transport-Security "max-age=15984000" always;
# Include redirects
include includes/redirects.conf;
# Include static
include includes/static.conf;
# Add rewrite for product feeds
location ~ ^/en/skroutzfeed\.xml {
expires 24h;
try_files /home/wpaper/public_html/skroutzfeed_en.xml /skroutzfeed_en.xml =404;
}
location ~ ^/el/skroutzfeed\.xml {
expires 24h;
try_files /home/wpaper/public_html/skroutzfeed_gr.xml /skroutzfeed_gr.xml =404;
}
location ~ ^/skroutzfeed\.xml {
expires 24h;
try_files /home/wpaper/public_html/skroutzfeed_gr.xml /skroutzfeed_gr.xml =404;
}
include includes/phpmyadmin.conf;
#include includes/solr.conf;
#location ~ ^/el {
# #set $magento_run_code "el";
# #set $magento_run_type "store";
#}
#location ~ ^/en {
# #set $magento_run_code "en";
# #set $magento_run_type "store";
#}
location / {
#expires 30d;
index index.html index.php;
set $magento_run_code "el";
set $magento_run_type "store";
try_files $uri $uri/ @handler;
}
location @handler {
rewrite / /index.php;
}
#location = /js/index.php/x.js {
# rewrite ^(.*\.php)/ $1 last;
#}
location ~ \.php {
expires off;
fastcgi_pass fastcgi_backend;
fastcgi_buffers 8 32k;
fastcgi_buffer_size 64k;
fastcgi_busy_buffers_size 64k;
fastcgi_connect_timeout 3000s;
fastcgi_read_timeout 3000s;
fastcgi_send_timeout 3000s;
fastcgi_param HTTPS $my_ssl;
fastcgi_param REMOTE_ADDR $http_x_real_ip;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_param REMOTE_ADDR $http_x_real_ip;
}
}
I have installed in this server Sphinx search with success. Index is running fine....But when I try to run some php scripts from my site's folder I get Nginx Authorisation required 401 error in console. I think it has something to do with the authentication we have in Nginx.
Can anyone help me what to do?
Edited 1 time(s). Last edit at 11/13/2018 12:16PM by ioannisg.