nginx-location

Angular2 - Nginx route 404 error on cloudfoundry

末鹿安然 提交于 2019-12-22 18:35:40
问题 I am using cloud foundry platform to deploy angular2 app using nginx based ststicfile buildpack. Upon refreshing on a sub route /my-route I am getting 404. I want any path such as www.mysite.com/some-ng2-router-path to redirect back to www.mysite.com I have seen several posts about this but I can't figure out how to edit the nginx.conf file on the server, and I do not want to use the hash bang approach. What do I do? Thanks 回答1: Are you trying to map routes within your app? e.g. cf map-route

Nginnx config for Yii 2 Advanced App Template

て烟熏妆下的殇ゞ 提交于 2019-12-21 02:16:08
问题 I would like to configure the Nginx web-server in such a way that: Requests to the /index.php URI should be handled by public_html/frontend/web/index.php Requests to the /admin/index.php URI should be handled by public_html/backend/web/index.php Advice please where I'm wrong. Here is my config: server { listen 80; server_name yii2.lo; server_tokens off; client_max_body_size 128M; charset utf-8; access_log /var/log/nginx/yii2-access.log main buffer=50k; error_log /var/log/nginx/yii2-error.log

How can I have same rule for two locations in NGINX config?

↘锁芯ラ 提交于 2019-12-17 17:25:07
问题 How can I have same rule for two locations in NGINX config? I have tried the following server { location /first/location/ | /second/location/ { .. .. } } but nginx reload threw this error: nginx: [emerg] invalid number of arguments in "location" directive** 回答1: Try location ~ ^/(first/location|second/location)/ { ... } The ~ means to use a regular expression for the url. The ^ means to check from the first character. This will look for a / followed by either of the locations and then another

Nginx Reverse proxy to remove port number

房东的猫 提交于 2019-12-14 03:35:32
问题 Need windows server setting to map the port domain abc.com:8145 to abc.com server {listen 8145; server_name abc.com;} Need server and location config to reverse proxy it can anyone provide the working example of redirecting website 回答1: server { listen 80; server_name abc.com location / { proxy_pass http://127.0.0.1:8145; // the IP is your server ip. proxy_set_header Host $host; //abc.com proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }

Rewrite directory as parameter

梦想的初衷 提交于 2019-12-14 02:06:09
问题 I'm trying to redirect requests from example.com/abc234 to example.com/setup.html?s=abc234 So far, I've tried the following, but it seems to always end up either 1) not transmitting the parameter or 2) ending up in an infinite loop (or 404) because it also tries to redirect the redirected request? The request has to be visibly rewritten because I want to pick up the parameter with JS, not PHP. server { server_name example.com; root /var/www/html; rewrite ^(.*)$ /setup.html?s=$1 redirect; } I

How to make assets work with Symfony3 in subdirectory on Nginx

故事扮演 提交于 2019-12-13 07:14:51
问题 Based on this question How to install symfony2 app in a subdirectory in nginx I've created symfony3 application that works in subdirectory called bcms4. I've manged to make php work with PHP-FPM but I have probelms with assets. When I want to GET asset it directs the request to app_dev and shows 404 because obviosly the path does not exist. My question is how to make assets not to be proccesed by app_dev but downloaded as supposed? So when I enter test.localhost/s/asdfad -> it runs symfony

How efficient is nginx prefix-based location handling implementation?

做~自己de王妃 提交于 2019-12-13 03:35:00
问题 How is the prefix string location handling implemented within nginx? http://nginx.org/r/location Specifically, it's widely reported that the http://nginx.org/r/server_name matching is done through a hash table — http://nginx.org/docs/http/server_names.html — but there isn't a similar level of detail on the implementation of the location directive. 回答1: The prefix-based location tree is defined to have 3 child node elements at each node: http://ngx.su/src/http/ngx_http_core_module.h#ngx_http

Access denied to Nginx folder with folders and files not being created

拜拜、爱过 提交于 2019-12-13 01:38:08
问题 I use Nginx at my company and am new at it. I'm just wondering if anyone had issues where the Nginx did NOT have enough privileges on Windows 10 NOT Ubuntu, but Windows 10 , to create files and directories within the Nginx folder. In my Nginx.conf , the user " nobody " and " pid " line are commented out so I know that Nginx is NOT using a user that does NOT belong to the Admin group. Even the " root " user, I did not find it in my conf file. Sometimes I can't even manually open up that Nginx

Nginx basic auth working on http but not on https

情到浓时终转凉″ 提交于 2019-12-12 05:09:04
问题 Im running nginx on centos 6. The domain is configured to use ssl. Some specific folders need to be password protected. If I type the url with http the basic the browsers asks to enter user and pass. If I type the same url with https then the index file of the specific folder will be shown without asking for user pass. I have this in my domain specific nginx.conf file: location /protected_folder { auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.htpasswd; } How can I make sure that

nginx - redirect subdirectories path to single (index.html) file

空扰寡人 提交于 2019-12-12 02:20:04
问题 How to redirect all the sub directory path to single index.html file? here is what i want nginx configuration: location /user/* { alias /home/vishant/devcenter/baetter-share1; index index.html; } this means if i hit /user OR /user/vishant OR /user/xyz/vishant it should render only index.html page. The code i have written is not working but what i thought should be similar to this. 回答1: location /user/ { root /home/vishant/devcenter/baetter-share1; try_files /index.html =404; } Documentation: