Simone: Alias Nginx-Proxy vs. Apache2 Alias

Beitrag lesen

Hi,

Danke für Dein Feedback!

Der Proxy läuft und antwortet korrekt

Request URL: http://192.168.4.1:9090/icons/image2.gif
Request Method: GET
Status Code: 200 OK
Remote Address: 192.168.4.1:9090
Referrer Policy: no-referrer-when-downgrade
Accept-Ranges: bytes
Connection: Keep-Alive
Content-Length: 309
Content-Type: image/gif
Date: Wed, 11 Dec 2019 16:54:03 GMT
ETag: "135-3e9564c23b600"
Keep-Alive: timeout=5, max=100
Last-Modified: Sat, 20 Nov 2004 20:16:24 GMT
Server: Apache/2.4.38 (Debian)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate
Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
Cache-Control: no-cache
Connection: keep-alive
Host: 192.168.4.1:9090
Pragma: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1

Meine Ng-conf sieht so aus

	map $http_origin $cors_origin_header
	{
			default "";
			"~(^|^http:\/\/)(localhost$|localhost:[0-9]{1,4}$)" "$http_origin";
			"https://webserver.test" "$http_origin";
	}

	map $http_origin $cors_cred
	{
			default "";
			"~(^|^http:\/\/)(localhost$|localhost:[0-9]{1,4}$)" "true";
			"https://webserver.test" "true";
	}



	# Expires map
	map $sent_http_content_type $expires {
		default                    off;
		text/html                  epoch;
		text/css                   max;
		application/javascript     max;
		~image/                    max;
	}


	#server_tokens off;
	add_header X-Frame-Options SAMEORIGIN;
	add_header X-Content-Type-Options nosniff;
	add_header X-XSS-Protection "1; mode=block";
	proxy_pass_header Server;



	server
	{


	gzip_disable "msie6";
	gzip_vary on;
	gzip_proxied any;
	gzip_comp_level 6;
	gzip_buffers 16 8k;
	gzip_http_version 1.1;
	gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;


	 listen 80;
			listen 443 ssl http2;

			server_name ~^(www\.)?(?<domain>.+)$;

			error_log /home/web/www/html/webserver.test/nginx/error_log.log debug;
			access_log /home/web/www/html/webserver.test/nginx/access_log.log combined;

			root /home/web/www/html/$domain/dist;

			index index.php index.htm index.html;


			ssl_certificate /home/web/www/html/webserver.test/ssl/webserver.test+1.pem;
			ssl_certificate_key /home/web/www/html/webserver.test/ssl/webserver.test+1-key.pem;
			ssl_protocols       SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2;
			ssl_ciphers         HIGH:MEDIUM:!aNULL:!MD5;

			add_header Access-Control-Allow-Origin $cors_origin_header always;
			add_header Access-Control-Allow-Credentials $cors_cred;
			add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD";
			add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";


			if ($request_method = 'OPTIONS')
			{
				return 204 no-content;
			}
			#Alias /icons/ "/usr/share/apache2/icons/"

			location ~ ^/icons/.* 
			{
				root /usr/share/apache2/;
			}
			
			location /
			{
				try_files $uri @proxy;
			}
		
			location ~* \.(js|css|jpg|jpeg|gif|png|svg|ico|pdf|html|htm)$
			{
				add_header X-Test-header static;        
			}

			location ~ \.php$ 
			{
				proxy_pass http://192.168.4.1:9090; 
				include /etc/nginx/proxy_params;
				add_header X-Test-header php; 
			}

			
			location @proxy
			{
				proxy_pass http://192.168.4.1:9090; 
				include /etc/nginx/proxy_params;
				add_header X-Test-header proxy;  
			}



			location ~ /\.ht
			{
				deny all;
			}
		
		expires $expires;
		
}