Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何为Ngnix重写Apache指令_Apache_Configuration_Nginx - Fatal编程技术网

如何为Ngnix重写Apache指令

如何为Ngnix重写Apache指令,apache,configuration,nginx,Apache,Configuration,Nginx,是否可以为Ngnix重写下一个Apache指令 1.设置默认字符集编码 阿帕奇: AddDefaultCharset UTF-8 2.重定向到一个域进行搜索引擎优化 阿帕奇: <IfModule mod_rewrite.c\> Options +Followsymlinks RewriteEngine On RewriteCond %{HTTP_HOST} ^domain\.com [OR] RewriteCond %{HTTP_HOST} ^do

是否可以为Ngnix重写下一个Apache指令

1.设置默认字符集编码 阿帕奇:

AddDefaultCharset UTF-8
2.重定向到一个域进行搜索引擎优化 阿帕奇:

<IfModule mod_rewrite.c\>
    Options +Followsymlinks
    RewriteEngine On

    RewriteCond %{HTTP_HOST} ^domain\.com [OR]
    RewriteCond %{HTTP_HOST} ^domain2\.com  [OR]
    RewriteCond %{HTTP_HOST} ^www\.domain2\.com
    RewriteRule ^(.*)$ http://www.domain2.com/$1 [R=301,L]    
</IfModule>


AddOutputFilterByType DEFLATE text/css

4.文本压缩 阿帕奇:

<IfModule mod_rewrite.c\>
    Options +Followsymlinks
    RewriteEngine On

    RewriteCond %{HTTP_HOST} ^domain\.com [OR]
    RewriteCond %{HTTP_HOST} ^domain2\.com  [OR]
    RewriteCond %{HTTP_HOST} ^www\.domain2\.com
    RewriteRule ^(.*)$ http://www.domain2.com/$1 [R=301,L]    
</IfModule>


AddOutputFilterByType DEFLATE text/css

一,

二,

三,

四,

server {
    server_name domain.com; 
    server_name domain2.com; 
    server_name www.domain.com; # www.domain2.com in RewriteCond, you mean www.domain.com?

    return 301 $scheme://www.domain2.com/$request_uri;   
}  
expires max; 
gzip on