I use lumen to make the API excuse, the URL is static, similar to this:
Https://www.foo.com/api/v1/ar ...
The ID here is the required parameter.
But when I call this interface, the pass-through parameter uses this URL format:
Https://www.foo.com/api/v1/ar ...
Can I change the URL format to support directly in Laravel or lumen? The form of a query?
Or in the Nginx rewrite method
: This article mainly introduces thinkphp's rewrite configuration in nginx. if you are interested in the PHP Tutorial, refer to it.
If (! -E $ request_filename) {# address as the rewrite parameter to index. php. # Rewrite ^/(. *) $/index. php/$1; # if it is a subdirectory, use the following sentence and change subdir
Find a simple pseudo-static Nginx Rewrite such as www. a. coma. php? The number following id2id is variable nbsp; I need to rewrite it to nbsp; s. a. coma. php? Id2 access www. a. coma. php? Id2 is reading s. a. coma. php? Id2 is not a redirection. I want to find a simple pseudo-static Nginx
alias directive.Use the break flag when using the PROXY_PASS directive. The last tag will be followed by the completion of this ruleServer{...} The label re-initiates the request, and the break flag terminates the match after the rule match is complete, and no longer matches the following rule. For example, the following rule must use the break flag, which causes a dead loop with the last tag.location/cms/{Proxy_pass http://test.youdomain.com;Rewrite
Symfonysymfony foreign very popular PHP framework, the current domestic use of relatively few, but will be in the domestic fire up. Nginx rewrite rules are as follows
server {
server_name jb51.net www.jb51.net;
root/data/site/www.jb51.net;
Location/{
# Try to serve file directly, fallback to rewrite
try_files $uri @rewriteapp;
}
Location @rewriteapp
Title, Apache rewrite is support or, with an or can, if not add or, a number of Rewritecond listed accumulation is and meaning. Then the Nginx rewrite is not so good. So how do you implement such a complex function? This uses the tagging function.Now there's a simple requirement: ask for a request to access a URI that starts with/abc/, and user_agent requests wit
Requirement: Access http://192.168.1.222:8099/ksdkfd/callback where KSDKFD is any characterJump to http://192.168.1.222:8099/api/paycb/ksdkfdLocation ~* ^/.+/callback$ {Index index.html index.htm;Rewrite "^/(. +)/callback" "/api/paycb/$1" permanent;}The difference between break and lastLocation/break {rewrite/break/(. *)/test/$1 break;echo Break page;}Location/last {rew
The problem is this:
I configured the route in the Symfony2, the prefixes are respectively:
/admin/api/wap...
such as
Now I want to access these three corresponding routes by accessing the three self-domains, respectively
admin.domain.com => /admin/*api.domain.com => /api/*wap.domain.com => /wap/*
At present under the Nginx configuration, but it does not work, want to see you have any ideas and methods of experience, pointing out, is now trapped.
ser
.
4, click the installation, follow the prompts to do the relevant configuration
5, configuration Well, again into the background, in the head will appear "My Site"-> "Management Network" Options menu, next you can manage or create a site, you can also open a theme or plug-ins for other sites to use.
6, if you want to bind other domain names to the site, you can install the WordPress MU domain Mapping plug-ins.
Nginx Multi-site
I want to implement user requests
x.com/api/dosomethingForward to the root directory of the Web site
/api.phpProcessing.
Files that do not exist are given to
/index.phpProcessing, nginx configuration is as follows
if (!-e $request_filename) { rewrite (.*) /index.php$1 last; }location ^~ /api/{ rewrite (.*) /api.php$1 last;}location ~ (index|api|a
Example
The code is as follows
Copy Code
server {Listen 80;root/path/to/dilicms/;Index index.php;server_name www.111cn.net; Location ~ ^ (/(application|system|services|shared|admin/backup|admin/config|admin/controllers|admin/core|amdin/ Errors|admin/hooks|admin/language))/{Deny all;} Location/{ if ($request _uri ~* index/?$){Rewrite ^/(. *)/index/?$/$1 Permanent;} if (!-d $request _filename){
time we agent to 8082 Port, that is Upload-service service
rewrite "^/api/(.*)$" /$1 break, Path rewriting:
"^/api/(.*)$": matches the regular expression of the path, using the grouping syntax, /api/ all future parts as 1 groups
/$1: The target path of the override, which is used to refer to the grouping that the preceding regular expression matches to (the group number starts at 1), which is /api/ all that follows. So the new p
Nginx rewrite and gzip functions, nginxrewritegzip
Rewrite Module name: ngx_http_rewrite_module is automatically compiled by default.
Command: rewrite regex replacement [flag]
Regex: a regular expression used to match the uri of a user request.
Replacement: result after Rewriting
Flag:
Last: After rewriting, stop
way of thinking: Nginx jump two times.You click to open the direct access is the dynamic URL, but made 301 jump to the back of this non-existent static page above, and here there is a pseudo-static rule, the static page to jump to the real dynamic page, but with the last tag, the URL will not change, so the front desk sees a static URLThe idea has, the back is simple, in front add a rewrite redirect can.Of
#访问 $uri # if exists $uri, visit him # If $uri are not end Of/and exists/vhosts/$http _host/$uri, visit him # if $uri is end of /And exists/cache/$http _host/$uri-/index.php #结束 (by [email protected]-please contact us if you have any errors) serve R{ Listen; server_namegame1.wap.loc game2.wap.loc game3.wap.loc wap.loc www.wap.loc; Location/ { RootD:/dev_wap; Indexindex.html index.htm index.php; Try_files$uri/vhosts/$http _host/$uri/cache/$http _host/$uri/index.html @
: This article describes examples of writing nginx pseudo-static rewrite rules. For more information about PHP tutorials, see. In the website configuration file www. huobo. cc. conf
.....
Server_name www. huobo. cc;Index index.html index.htm index. php;Root/home/wwwroot/huobo;......Add it under the root lineIncludeHuobo. cc. conf;
Content:
Location /{Rewrite
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.