美文网首页
Joomla 伪静态

Joomla 伪静态

作者: 牧民 | 来源:发表于2018-10-24 11:03 被阅读10次

Install nginx

For Ubuntu, run aptitude install nginx. For other distros, run the corresponding package manager, or see http://wiki.nginx.org/Install.

Install PHP FastCGI

For Ubuntu, read this excellent page on how to configure PHP and FastCGI for nginx.

For Gentoo, PHP will run as a FastCGI service (fpm), so the nginx server will run PHP as a separated process:

The default settings of php-fpm are good for most servers. For special configurations, visit the PHP FPM site.

Configure Nginx

nginx configuration files reside in:

/etc/nginx/sites-available/ on Ubuntu (for sites running on that nginx instance)
/etc/nginx/nginx.conf on Gentoo and Raspbian(= Debian optimized for Raspberry Pi)
Here is an sample nginx configuration file, joomla.conf, that you can reuse over all your nginx enabled-sites.

server {
        listen 80;
        server_name YOUR_DOMAIN;
        server_name_in_redirect off;

        access_log /var/log/nginx/localhost.access_log;
        error_log /var/log/nginx/localhost.error_log info;

        root PATH_ON_SERVER;
        index index.php index.html index.htm default.html default.htm;
        # Support Clean (aka Search Engine Friendly) URLs
        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        # deny running scripts inside writable directories
        location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
                return 403;
                error_page 403 /403_error.html;
        }

        location ~ \.php$ {
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include /etc/nginx/fastcgi.conf;
        }

        # caching of files 
        location ~* \.(ico|pdf|flv)$ {
                expires 1y;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
                expires 14d;
        }

}

Pay attention to a few things:

  1. The parameter fastcgi_pass is set to 127.0.0.1:9000, corresponding to the port that fpm is configured to listen to. This means you can run the PHP processes on separate servers. On Gentoo, you can find this configuration in /etc/php/fpm-php5.3/php-fpm.conf/
  2. Don't forget to replace YOUR_DOMAIN & PATH_ON_SERVER above depending on your domain and the path of Joomla on your server.

GZip support

If you need GZip compression support, add the following section to the http section of the main nginx configuration file:

        gzip on;
        gzip_http_version 1.1;
        gzip_comp_level 6;
        gzip_min_length 1100;
        gzip_buffers 4 8k;
        gzip_types text/plain application/xhtml+xml text/css application/xml application/xml+rss text/javascript application/javascript application/x-javascript
        gzip_proxied     any;
        gzip_disable     "MSIE [1-6]\.";


相关文章

  • Joomla 伪静态

    Install nginx For Ubuntu, run aptitude install nginx. For...

  • 伪静态实现

    伪静态实现 伪静态:没有静态文件的静态化 伪静态实现【1代码实现】比如这个网页http://www..net/so...

  • 真伪静态

    有同学问到 真静态 和 伪静态,画图说明: 1.服务端真伪静态真静态 和 伪静态 2.客户端也可以通过路由来实现伪静态

  • phpcms v9伪静态设置

    好吧,网上关于phpcms伪静态的教程很少,尤其是关于企业黄页的伪静态,还是没有搞定,但是先处理了网站的伪静态。 ...

  • SQLmap常规伪静态注入

    伪静态生成两种方式 框架伪静态利用组件把asp后缀显示为htmlSQL注入防御中,伪静态起到了一定作用,但不能完全...

  • seo中的url结构优化

    一、url结构(访问结构)(链接结构) url一般有:静态链接,动态链接,伪静态链接 伪静态对seo来说非常...

  • CSS自带的伪类选择器

    我们使用CSS自带的伪类选择器,从而可以更加方便的完成页面点击事件 css伪类选择器:分为静态和静态 静态伪类 只...

  • CSS自带的伪类选择器

    我们使用CSS自带的伪类选择器,从而可以更加方便的完成页面点击事件 css伪类选择器:分为静态和静态 静态伪类 只...

  • 真静态和伪静态的优缺点

    真静态和伪静态的优缺点 真静态和伪静态的优缺点html静态页(真静态)的好处有三点;一是减少服务器对数据响应的负荷...

  • 深圳seo优化:伪静态为什么有利于网站优化?

    经常听到很多朋友问到伪静态的问题,今天深圳seo优化阿星就来为大家科普一下伪静态的知识,好让大家对伪静态有个全新的...

网友评论

      本文标题:Joomla 伪静态

      本文链接:https://www.haomeiwen.com/subject/nkyttqtx.html