Objective
原创文章欢迎转载,请保留出处。若有任何疑问建议,欢迎回复。邮箱:[email protected]
Search today, found that there is no similar article, although relatively simple, but still write a blog post, mainly on how to build nginx and configure the DWZ framework.
Installing Nginx
First install the Nginx must be the library, direct yum installation on the line, note to be executed under the root authority.
installinstallinstall zlib
Next install Nginx, in order to avoid trouble, I also intend to install with Yum, but because the official Yum source does not have nginx, we must first modify
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
You can then install it using Yum:
install nginx
After installation, start the Nginx service test:
start
If you open Firefox after successful startup (be careful not to work in offline mode, check in file (F)-Work offline (W), enter
http://localhost
The result of the Nginx service running successfully:
If it fails, be careful to check your firewall and browser settings.
Configuring the DWZ Framework
这个DWZ富客户端框架已经改名j-ui了,不过我们还是使用旧版的稳定的1.1.4版。这个框架以HTML扩展的方式代替JavaScript代码,基于JQuery的,可以非常方便的定制开发特定需求的UI组件,并以JQuery插件的形式发布。框架完全开源,任何人都可以免费获得一套完全的源代码。
First download the demo of DWZ, which provides a
http://download.csdn.net/detail/maxwell_nc/8621337
Unzip the demo folder to a directory, I am here /home/max/dwz/dwzdemo
Here to remember the directory, the configuration needs to use.
modifying Nginx configuration Files
vi /etc/nginx/conf.d/default.conf
Modify the following:
The main modification of the website encoding method to Utf-8, the root directory to change to the demo directory, set the redirect 405, to prevent 405 problems (because access to static files can only use the Get method, can not use post, In Nginx 0.6.33 after the addition of a 405 error status code, can not use post to request static files, but we do not bother to modify the DWZ code, redirected 405 return to 200, that is, if you encounter 405, as 200 processing, so that will not be wrong. In addition to the error_page to comment, about the default.conf there are other configuration methods, you can also add location modification, here is not detailed.
The complete configuration file is as follows:
server {Listen the; server_name localhost; CharSet utf-8;#charset koi8-r; #access_log/var/log/nginx/log/host.access.log main;Location/{Root/home/max/dwz/dwzdemo;#root/usr/share/nginx/html; Index Index. htmlIndex. htm; Error_page405= $ $; }#error_page 404/404.html; # REDIRECT Server error pages to the static page/50x.html # #error_page 502 503 504/50x.html; #location =/50x.html { # root/usr/share/nginx/html; #} # Proxy The PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # Proxy_pass http://127.0.0.1; #} # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root HTML; # Fastcgi_pass 127.0.0.1:9000; # Fastcgi_index index.php; # Fastcgi_param Script_filename/scripts$fastcgi_script_name; # include fastcgi_params; #} # Deny access to. htaccess files, if Apache ' s document Root # concurs with Nginx ' s one # #location ~/\.ht { # deny all; #}}
This will configure the site. We re-start the Nginx service:
service nginx restart
Open Firefox Right click on the tab (F5 does not seem to refresh the new page), reload after the 403 error
This is caused by a permission problem, let's look at the Nginx settings:
vi /etc/nginx/nginx.conf
Nginx Default User is Nginx, we do not have this user on the computer, so there will be permissions issues, modified to be able to access the demo file users, I here to modify as a normal user, you can create a Nginx user grant permissions, but not recommended to use the root user.
Restart Nginx service after saving:
service nginx restart
Open Firefox Right click on the tab (F5 does not seem to refresh the new page), reload after the DWZ demo page, try to check whether a page test can be used, can be used to represent DWZ can work.
Due to limited time, the next opportunity will be updated on how to customize the DWZ framework.
Build Nginx and configure DWZ Framework on CentOS 6.5