歡迎您光臨本站 註冊首頁

apache配置轉換成nginx問題

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

apache配置轉換成nginx問題

問個將apache的配置轉換成nginx的配置是否正確

<VirtualHost *:80>
    ServerName www.test.com
    ServerAlias www.gameserver.com
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/usr/local/gameserver/htdocs/"
    <Directory /usr/local/gameserver/htdocs/>
      Options FollowSymLinks
      AllowOverride None
      Order deny,allow
      Allow from all
    </Directory>
    <IfModule dir_module>
      DirectoryIndex index.html
    </IfModule>
    HostnameLookups off
    <Files ~ "\.(html|cgi)$">
      HostnameLookups on
    </Files>
    ScriptAlias /cgi-bin/ /usr/local/webserver/gamecgi/
    <Directory /usr/local/webserver/gamecgi/>
      Options +ExecCGI
      AddHandler cgi-script .cgi
      AllowOverride None
      Order Deny,Allow
      Allow from all
    </Directory>
    #DBDExptime 300
    #DBDKeep 1
    #DBDMax 1
    #DBDMin 1
    #DBDPersist On
    #DBDriver mysql
    #DBDPrepareSQL "show databases"
    #DBDParams "host=192.168.1.249 port=3306 user=apache_user pass=apache_passwd dbname=mysql"
    ErrorLog "logs/gameserver.com-error_log"
    CustomLog "logs/gameserver.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
    ServerName img.test.com
    ServerAlias www.gameserver.com
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/usr/local/gameserver/htdocs/img"
    <Directory /usr/local/gameserver/htdocs/>
      Options FollowSymLinks
      AllowOverride None
      Order deny,allow
      Allow from all
    </Directory>
    <IfModule dir_module>
      DirectoryIndex index.html
    </IfModule>

    ErrorLog "logs/gameserver.com-error_log"
    CustomLog "logs/gameserver.com-access_log" common
</VirtualHost>


轉換成nginx怎麼就不行請教

server
{
  listen       83;
  server_name  demo.test.com;
  index index.php index.html index.htm;
  root   /usr/local/gameserver/htdocs/;
location ~ .*\.php?$
  {
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_index   index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME /usr/local/gameserver/htdocs$fastcgi_script_name;
}
  
  location ~ \.cgi$ {
     rewrite ^/gamecgi/(.*)\.cgi /$1.cgi break;
     fastcgi_pass unix:/tmp/nginx-fcgi.sock;
     fastcgi_index index.cgi;
     fastcgi_param SCRIPT_FILENAME /usr/local/webserver/gamecgi$fastcgi_script_name;
     fastcgi_param HTTP_ACCEPT_LANGUAGE en_US;
     include fastcgi_params;
  }
  location ~ \.pl$ {
     fastcgi_pass  unix:/tmp/nginx-fcgi.sock;
     fastcgi_index index.pl;
     fastcgi_param SCRIPT_FILENAME /usr/local/webserver/gamecgi$fastcgi_script_name;
     include fastcgi_params;
  
}
}
《解決方案》

把錯誤日誌
貼出來看看
{:3_179:}
《解決方案》

按點檢查,對症分析。
《解決方案》

一個開源的Linux下運行的命令行工具,能將Apache的配置文件轉換成相應的Nginx的配置文件。本工具能自動將Apache Web伺服器的配置文件轉化成Nginx的配置文件,減少WEB伺服器遷移的工作量。 該工具從Apache Web伺服器中的各模塊功能的角度進行分析,生成Nginx中相應模塊的配置方式,然後以報告的形式生成轉換后的Nginx配置文件。   
https://github.com/nhnc-nginx/apache2nginx

[火星人 ] apache配置轉換成nginx問題已經有532次圍觀

http://coctec.com/docs/service/show-post-12455.html