Drupal7’s cleanurl and Nginx pseudo-static rules

My website main directory is E:\www-test\mywwwroot\ , I put my drupal7 in E:\www-test\mywwwroot\drupal-7.0. . localhost:8087 directly reads the main directory of the website E:\www-test\mywwwroot\, I opened a new website localhost:8077, and set its main directory to E:\www-test\mywwwroot\drupal-7.0 There are tutorials online that say If Drupal is installed in the root directory, 1 2 3 4 if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?q=$1 last; break; } if drupal is in a subdirectory, 1 2 3 4 if ($request_uri ~* ^.*/.*$) { rewrite ^/(\w*)/(.*)$ /$1/index.php?q=$2 last; break; } But the conf file of nginx is set as: server { listen 8078; server_name www.server110.com; error_log logs/erro-for-rewriter-8078.log notice; rewrite_log on; autoindex on; ######### When the website does not have a default file, open the domain name to see the file directory structure #charset koi8-r; #access_log logs/host.access.log main; location /drupal-7.0/ { index index index.html index.htm index.php; if (-f $request_filename) { expires 30d; break; } if (!-e $request_filename) { rewrite ^ /drupal-7.0/index.php last; break; } } #error_page 404 /index.php; # 404 Hand over to index.php # error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the…

ApacheiiszeusNginxrewrite pseudo-static rules for Discuz forum

Apache Web Server (dedicated hosting users) RewriteEngine On RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2 &extra=page\%3D$4&page=$3&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^(.*)/([a-z]+)-(.+)\.html$ $1/$2.php?rewrite=$3&%1 Apache Web Server (virtual host user) # Turn on RewriteEngine mode RewriteEngine On # Modify /discuz in the following statement to your forum directory address, if the program is placed in the root directory, please change /discuz to / RewriteBase /discuz # Rewrite system rules do not modify RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3 &page=$2&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^([a-z]+)-(.+)\.html$ $1.php?rewrite=$2&%1 IIS Web Server (Dedicated Hosting Users) [ISAPI_Rewrite] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 # Protect httpd.ini and httpd.parse.errors files # from accessing through HTTP RewriteRule ^(.*)/topic-(.+)\.html\?*(.*)$ $1/portal\.php\?mod=topic&topic=$2&$3 RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/portal\.php\?mod=view&aid=$2 &page=$3&$4 RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3& $4 RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forum\ .php\?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$5 RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forum\.php\?mod=group&fid=$2 &page=$3&$4 RewriteRule ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$ $1/home\.php\?mod=space&$2=$3&$4 RewriteRule ^(.*)/([a-z]+)-(.+)\.html\?*(.*)$ $1/$2\.php\?rewrite=$3&$4 Zeus Web Server match URL into…

DiscuzX forum Nginxrewrite pseudo-static rules explanation

Look at a few examples first! Example 1 Discuz(X2.5) URL static (pseudo-static) page markup format 1 Portal topic page {name} topic-{name}.html 2 Portal article page {id}, {page} article-{id}-{page}.html 3 Forum topic list page {fid}, {page}          forum-{fid}-{page}.html 4 Forum topic content page {tid}, {page}, {prevpage} thread-{tid}-{page}-{prevpage}.html  5 Group theme list page {fid}, {page}          group-{fid}-{page}.html 6 User’s personal homepage {user}, {value} space-{user}-{value}.html 7 User log content page {uid}, {blogid} blog-{uid}-{blogid}.html Nginx Rewrite rewrite ^/$ /forum.php last; rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topicid=$2 last; rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last; rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last; rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod =viewthread&tid=$2&extra=page%3D$4&page=$3 last; rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last; rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last; rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last; if (!-e $request_filename) { return 404; } Nginx Rewrite Process Forum topic list page {fid}, {page} forum-{fid}-{page}.html browser http://bbs.test.com/forum-2-1.html | nginx rewrite rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last; | real url http://bbs.test.com/forum.php?mod=forumdisplay&fid=2&page=1 Forum topic content page {tid}, {page}, {prevpage}    thread-{tid}-{page}-{prevpage}.html browser http://bbs.test.com/thread-8-1-1.html | nginx rewrite rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last; | real url http://bbs.test.com/forum.php?mod=viewthread&tid=8&extra=page%3D1&page=1 Example 2 WordPress(3.4.1) permalink settings (pseudo-static) default http://blog.test.com/?p=123 month and name type http://blog.test.com/index.php/2012/08/sample-post/ /index.php/%year%/%monthnum%/%postname%/ Nginx Rewrite code if (-f $request_filename/index.html) { rewrite (.*) $1/index.php last; } if (-f $request_filename/index.php) { rewrite (.*) $1/index.php last; } if (!-f $request_filename) { rewrite (.*) /index.php last; } Nginx Rewrite…

Nginx installation fastdfs module process record

How to Install the PCRE library? SSH to the server as user ‘root’ 1) First, goto a temporary directory # cd /usr/local/src 2) Download PCRE: # wget http://downloads.sourceforge.net/pcre/pcre-8.10.tar.bz2 3) Unpack and change to the pcre directory # tar -jxf pcre-8.10.tar.bz2 # cd pcre-8.10 4) Confiure PCRE: # ./configure 5) Create the installation files and install PCRE # make # make install Once done, you should be able to install Nginx with the HTTP rewrite module. 1.In function ‘fdfs_http_request_handler’ In this case, just download the latest fastdfs_ngix1.06 version 2. If all the installations are successful, don’t forget to modify the store_path0=/home/soar/storage/data path of mod_fastdfs.conf when configuring

Nginx server configuration supports django’s uwsgi operating environment

django deployment based on nginx + uwsgi 1. Environment construction: 1. sudo apt-get install nginx 2. sudo pip install uwsgi The debian/buntu system needs to be installed separately: In a debian/ubuntu system you can install them with: 3. apt-get install build-essential python-dev libxml2-dev nginx: http://nginx.com/ uwsgi: http://projects.unbit.it/uwsgi/ 2. Create a new project: 1. Project path: Project path: /home/kevin/workspace/myproject Static files: /home/kevin/workspace/myproject/public Application path: /home/kevin/workspace/myproject/myapp 3. nginx configuration: 1. sudo vim /etc/nginx/sites-enabled/default Test configuration file: server { location / {         include uwsgi_params; uwsgi_pass 127.0.0.1:9090; } location /static/ { alias /home/kevin/workspace/myproject/public; autoindex on; allow 127.0.0.1; Deny all; } } 4. uwsgi configuration: 1. django_wsgi.py import os import sys import django.core.handlers.wsgi if not os.path.dirname(__file__) in sys.path[:1]: sys.path.insert(0, os.path.dirname(__file__)) os.environ[‘DJANGO_SETTINGS_MODULE’] = ‘myproject.settings’ application = django.core.handlers.wsgi.WSGIHandler() 2. uwsgi.xml /home/kevin/workspace/myproject .. django_wsgi Both django_wsgi.py and uwsgi.xml files are placed in the myproject directory 5. Start nginx, uwsgi: Start nginx: sudo nginx Start uwsgi: uwsgi -s 127.0.0.1:9090 -x uwsgi.xml 5. Access: 127.0.0.1 Just this memo Parts four and five can be omitted: uwsgi -s 127.0.0.1:9090 -M -R 2000 -p 16 –env DJANGO_SETTINGS_MODULE=settings -w “django.core.handlers.wsgi:WSGIHandler()”

Compilation, installation and configuration method of Nginx server in Debian system

(Author: Xiaole Chengcheng) I tested Debian again in the past two days, the installation and operation are similar to Ubuntu, you can use apt-get to install or download software packages, but because Debian uses apt- get install The nginx version installed by default in nginx is version 0.4.13, and I want to use apt-get to install version 0.6.32, but I haven’t found a solution yet , It should be said that I don’t know how to install it, and I hope that friends who know it will reply by leaving a message. Since apt-get cannot install version 0.6.32, only manual compilation is used. First of all, everyone knows that pcre, zlib, and openssl need to be specified to compile nginx. Since my system does not have these packages installed, I will not install the deb packages. I will download these packages directly. The official website: http://www.zlib.net/ http://www.openssl.org/ http://www.pcre.org/ Download these three packages to the /opt directory, tar -xzvf *.gz decompression, and then decompress the nginx-0.6.32 package to the /opt directory, enter the nginx directory, and execute: #./configure –with-pcre=../pcre-7.7 –with-zlib=../zlib-1.2.3 –with-openssl=../openssl-0.9.8g #make && make install If there is an error in ./configure, check the problem in turn. Generally, there will be…

Install PHP and Nginx environment under Debian system

1. Install php apt-get install php5-cgi php5-mysql php5-gd -yf –force-yes; 2. Install nginx First install some necessary software (pcre and zlib): apt-get install libpcre3-dev -yf –force-yes; apt-get install zlib1g-dev -yf –force-yes; You can install version 0.6.32 of nginx with apt-get under debian, but I usually don’t use this version, it’s relatively old, so download nginx to compile and install: wget http://sudone.com/download/nginx/nginx-0.7.30.tar.gz -O /tmp/nginx.tar.gz cd /tmp/ tar -zxf nginx.tar.gz cd nginx-0.7.30 ./configure –with-http_realip_module –prefix=/usr/local/nginx/ –with-poll_module –with-cpu-opt=pentium4 –with-md5=/usr/lib –with-sha1=/usr/lib –with-openssl=/usr/lib –with-http_sub_module –with-cc-opt=”-I /usr/include/pcre” make -j10 make install 3. Use spawn-fcgi to start php cd /usr/local/nginx/sbin wget http://sudone.com/download/spawn-fcgi chmod +x spawn-fcgi spawn-fcgi -a 127.0.0.1 -p 9000 -u nobody -f /usr/bin/php-cgi -C 20 echo “/usr/local/nginx/sbin/spawn-fcgi -a 127.0.0.1 -p 9000 -u nobody -f /usr/bin/php-cgi -C 20” >> /etc/rc.local 4. Configure nginx (example) server { include port.conf; server_name test.com; location / { root /www; index index.html index.htm index.php; } location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /www$fastcgi_script_name; include fastcgi_params; } } Start and restart nginx: Start: /usr/local/nginx/sbin/nginx Restart: kill -HUP `cat /usr/local/nginx/logs/nginx.pid` or killall -9 nginx;/usr/local/nginx/sbin/nginx 5. PHP configuration The php configuration file php.ini is located at /etc/php5/cgi/php.ini, modify this file if necessary, and restart php-cgi with the following statement: killall -9 php-cgi;…

Debian6 (squeeze) installation and configuration Nginx+PHP5+PHP-fpm+MySQL environment

Debian 6 (Squeeze) has finally released the official version, which is very exciting. The technology of ramhost is also very good, and the system of debian6 will be released soon Mirror, replace it at the first time, initialize the system, and then start the classic nginx+php+mysql website architecture The installation, let’s go! 1: Add source, support php5-fpm vi /etc/apt/sources.list Add the following sources deb http://packages.dotdeb.org stable all After modification and saving wget http://www.dotdeb.org/dotdeb.gpg cat dotdeb.gpg | apt-key add – rm dotdeb.gpg apt-get update 2: Install MySQL 5 apt-get install mysql-server mysql-client Enter the password twice on the pop-up page Modify the mysql configuration file and remove innodb, which can save a lot of memory vi /etc/mysql/my.cnf Add the following statement skip-innodb After saving, restart mysql to take effect 3: Install Nginx+php+php5-fpm+memcache apt-get install php5-cgi php5-mysql php5-gd php5-imagick php5-mcrypt php5-memcache memcached php5-fpm php5-cli nginx After the installation is successful, rcconf removes the redundant service x11-common mkdir /var/www chown www-data:www-data /var/www Modify the port and memory size of memcache vi /etc/memcached.conf vi /etc/php5/cgi/php.ini Modify the following sentence cgi.fix_pathinfo=1 Mine is a 512M vps, so modify the configuration file of php-fpm vi /etc/php5/fpm/pool.d/www.conf pm.max_children = 25 pm.start_servers = 4 pm.min_spare_servers = 2 pm.max_spare_servers…

Install Nginx on CentOS system and configure mono to run ASP.NET program

Installation steps: 1. Obtain open source related programs: 1. Use the yum command that comes with the CentOS Linux system to install and upgrade the required program library: sudo -s LANG=C yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel bison pkgconfig glib2-devel gettext make 2. Download the program source package: Nginx installation package: download address: http://nginx.org/en/download.html mkdir -p /down cd /down wget http://nginx.org/download/nginx-1.1.11.tar.gz Mono download: Official website: http://download.mono-project.com/sources/mono/ (please download the latest version) wget http://download.mono-project.com/sources/mono/mono-2.10.7.tar.bz2 libgdiplus download: http://download.mono-project.com/sources/libgdiplus/ (please download the latest version) wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.tar.bz2 xsp download: http://download.mono-project.com/sources/xsp/ (please download the latest version) wget http://download.mono-project.com/sources/xsp/xsp-2.10.2.tar.bz2 pcre download (pcre library required by Nginx): ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ (please download the latest version) wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.21.tar.gz 2. Install and compile Nginx: 1. Install the pcre library required for installing Nginx: cd /down tar zxvf pcre-8.21.tar.gz cd pcre-8.21/ ./configure make && make install cd ../ 2. Create www user and group /usr/sbin/groupadd www /usr/sbin/useradd -g www www mkdir -p /data0/web chmod +w /data0/web chown -R www:www /data0/web 3. Install Nginx tar zxvf nginx-1.1.11.tar.gz cd nginx-1.1.11/ ./configure –user=www –group=www –prefix=/opt/nginx –with-http_stub_status_module –with-http_ssl_module make && make install cd ../ 4. Open port 80: iptables -I…

CentOS system uses yum to install Nginx and PHP operating environment

1. Change the yum source to NetEase’s source to speed up vi /etc/yum.repos.d/CentOS-Base.repo The changes are as follows # CentOS-Base.repo # # This file uses a new mirrorlist system developed by Lance Davis for CentOS. # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever-Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-$releasever-Updates #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released [addons] name=CentOS-$releasever-Addons #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons #baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/ baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS-$releasever-Extras #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever-Plus #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 Two, update yum yum -y update 3. Use the yum command that comes with the CentOS Linux system to install and upgrade the required program library LANG=C yum -y install…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索