Chinaunix

标题: 关于nginx+php5.3.8+eclipse3.7工作空间的配置 [打印本页]

作者: 中关村村草    时间: 2011-11-24 17:22
标题: 关于nginx+php5.3.8+eclipse3.7工作空间的配置
关于nginx+php5.3.8+eclipse3.7工作空间的配置







导语:以前用eclipse3.6时设置php服务器时完全可以在base url栏填写自己工作空间的目录,然后修改nginx.conf加一个alias就行了。因此可以直接在自己的工作空间运行程序,但当用到eclipse3.7和PDT3.0.2的集成时居然不允许在base url栏填写自己工作空间的目录了,网上查阅包括英文仍无办法,因此只得另想办法。

这个版本的PDT只允许填写不同端口号的base url 的服务器,所以我就在nginx另作一个不同于主端口号的服务端口,把这个端口号的主目录定位到eclipse的工作空间,然后把eclipse的php服务器设置为这个端口号,以后在eclipse工作空间的工程都能自动运行了。

于是修改nginx.conf添加以下几行:
  1.     #eclipse web port:    #        server {        listen       5000;        server_name  localhost;        #charset koi8-r;        #access_log  logs/host.access.log  main;        location / {            root   "C:/Program Files/eclipse-php/workspace";            index  index.html index.htm index.php;        }                        location ~ \.php$ {            root           html;            fastcgi_pass   127.0.0.1:9000;            fastcgi_index  index.php;            fastcgi_param  SCRIPT_FILENAME  c:/PROGRA~1/eclipse-php/workspace$fastcgi_script_name;            fastcgi_split_path_info     ^(.+\.php)(.*)$;              fastcgi_param  PATH_INFO     $fastcgi_path_info;            include        fastcgi_params;        }    }如果你有ssl设置,可以再添加:

  2.     server {        listen       5443;        server_name  localhost;        ssl                  on;        ssl_certificate      akann.crt;        ssl_certificate_key  akann.key;    #    ssl_session_timeout  5m;    #    ssl_protocols  SSLv2 SSLv3 TLSv1;    #    ssl_ciphers  HIGH:!aNULL:!MD5;    #    ssl_prefer_server_ciphers   on;        location / {            root   "C:/Program Files/eclipse-php/workspace";            index  index.html index.htm index.php;        }        location ~ \.php$ {            root           html;            fastcgi_pass   127.0.0.1:9000;            fastcgi_index  index.php;            fastcgi_param  SCRIPT_FILENAME  c:/PROGRA~1/eclipse-php/workspace$fastcgi_script_name;            fastcgi_split_path_info     ^(.+\.php)(.*)$;              fastcgi_param  PATH_INFO     $fastcgi_path_info;            fastcgi_param  HTTPS on;            include        fastcgi_params;        }    }这里记住"C:/Program Files/eclipse-php/workspace"和c:/PROGRA~1/eclipse-php/workspace
复制代码
就是你工作空间的目录,我用的是windows,unix目录自行修改。

另外再修改eclipse的php服务器设置:



一切ok.




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2