Enter/usr/local/nginx/conf
Edit nginx.conf bound domain name: Add a server element, the changed configuration content may be as follows: Server{listen ; server_name Xmdm.easymobi.cn;index index.html index.htm index.php;root/home/wwwroot;location ~ *\. (PHP|PHP5)? ${fastcgi_pass unix:/tmp/php-cgi.sock;fastcgi_index index.php;include fcgi.conf;} Location/status {stub_status On;access_logoff;}location ~. *\. (gif|jpg|jpeg|png|bmp|swf) ${expires 30d; }location ~. *\. (JS|CSS)? ${expires 12h; }log_format access ' $remote _addr-$remote _user [$time _local] "$request" ' $status $body _bytes_sent ' $http _referer ' ' "$http _user_agent" $http _x_forwarded_for '; Access_log/home/wwwlogs/xmdm.log access;} Here, the domain name: xmdm.easymobi.cn is bound to the machine. If you want to bind another one, add another server. Note that when you add your own server:Log_format Accessafter the format cannot be the same. Otherwise it will be an error. url-rewrite: Often see the following link: http://www.ssss.com/3/4/cmd when this HTTP request passes through the Web server, it is parsed by the rewrite rule to another address, such as http:// Www.ssss.com/index.php?a=3&b=4&c=cmd If the rewrite rule is not defined, the address above must not be found. The Nginx definition method is very similar to that of Apache, as follows: Location/{rewrite ^/category/(\d+)/(. +)/(\d+) $/category.php?cateid=$1&nowpage=$3 Last;rewrite ^/detail/(\d+)/(. +) $/detail.php?id=$1 last;rewrite ^/result/(. +)/(\d+)/(\d+) $/result.php?keyword=$1 &id=$2&nowpage=$3 last;rewrite ^/result/(\d+)/(\d+) $/result.php?id=$1&nowpage=$2 last;} Location/indicates access to the address under the root of the domain name there are two regular expressions following rewrite, the first one is the address entered by the user, and the latter is to be escaped. After editing is complete, you need to reload Nginx: Enter Usr/local/nginx/sbin execution:./nginx-s reload under an Apache under the Setup method: <ifmodule mod_rewrite.c >rewriteengine on rewriterule ^/?category/(\d+)/(. +)/(\d+) $ category.php?cateid=$1&nowpage=$3 [L] Rewriterule ^/?detail/(\d+)/(. +) $ detail.php?id=$1 [L]rewriterule ^/?result/(. +)/(\d+)/(\d+) $ result.php?keyword=$1 &id=$2&nowpage=$3 [L]rewriterule ^/?result/(\d+)/(\d+) $ result.php?id=$1&nOwpage=$2 [l]</ifmodule> This paragraph I put in the. htaccess.
Linux--nginx domain name binding-url rewrite