我有 nginx 配置:
server
{
listen 80;
server_name mail.myserver.com;
rewrite ^(.*) https://$server_name$request_uri? permanent;
}
server
{
# By default we listen on all ips including ipv6 on port 443. We only respond to the server name here.
# If you have a default ssl website already comment out the next line and uncomment the one after..
listen 443;
#listen 443 ssl;
server_name mail.myserver.com;
# Our logs files.
access_log /var/log/nginx/iredmail-access.log;
error_log /var/log/nginx/iredmail-error.log;
# Startup SSL using iRedMails certs.
# If you made the ssl change above you will need to make this one to enable ssl.
ssl on;
ssl_certificate /etc/ssl/certs/iRedMail_CA.pem;
ssl_certificate_key /etc/ssl/private/iRedMail.key;
ssl_session_timeout 5m;
# We specify our root location to roundcubemail.
root /usr/share/apache2/roundcubemail/;
index index.html index.php;
# Aliasing some locations of static files.
location /iredadmin/static { alias /usr/share/apache2/iredadmin/static/;}
location /static { alias /usr/share/apache2/iredadmin/static/;}
location /awstats/icon { alias /usr/share/awstats/icon/;}
location /awstatsicon { alias /usr/share/awstats/icon/;}
# This allows webmail and roundcube as aliases to /mail/. The root is redirected to /mail.
rewrite ^/roundcubemail /mail/ permanent;
rewrite ^/webmail /mail/ permanent;
rewrite ^/$ /mail/ permanent;
# This is used to create a comparision to Apaches ability to alias that works with dynamic scripts.
location ~ /mail(.*)\.php($|/)
{
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/fpm-iredmail.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/apache2/roundcubemail$1.php;
fastcgi_param SERVER_NAME $http_host;
fastcgi_ignore_client_abort on;
fastcgi_intercept_errors off;
}
location ~ /mail(.*)
{
autoindex on;
alias /usr/share/apache2/roundcubemail$1;
}
location /iredadmin {
root /usr/share/apache2/iredadmin/;
uwsgi_pass 127.0.0.1:9001;
#uwsgi_pass unix:///var/run/uwsgi/app/iredadmin/iredadmin.socket;
uwsgi_param UWSGI_PYHOME /usr/share/apache2/iredadmin/python-home;
uwsgi_param UWSGI_CHDIR /usr/share/apache2/iredadmin;
uwsgi_param UWSGI_SCRIPT iredadmin;
include uwsgi_params;
}
# Our phpMyAdmin service. Comment this section out if you don't want public access to it.
location ~ /phpmyadmin(.*)\.php($|/)
{
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
#uwsgi_pass unix:///var/run/uwsgi/app/iredadmin/iredadmin.socket;
uwsgi_param UWSGI_PYHOME /usr/share/apache2/iredadmin/python-home;
uwsgi_param UWSGI_CHDIR /usr/share/apache2/iredadmin;
uwsgi_param UWSGI_SCRIPT iredadmin;
include uwsgi_params;
}
# Our phpMyAdmin service. Comment this section out if you don't want public access to it.
location ~ /phpmyadmin(.*)\.php($|/)
{
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/fpm-iredmail.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$1.php;
fastcgi_param SERVER_NAME $http_host;
fastcgi_param HTTPS on;
fastcgi_param HTTP_SCHEME https;
fastcgi_ignore_client_abort on;
fastcgi_intercept_errors off;
port_in_redirect off;
}
location ~ /phpmyadmin(.*)
{
autoindex on;
alias /usr/share/phpmyadmin$1;
}
}
如果我转到/iredmail,我会收到错误“uWSGI Error Python application not found”
uwsgi 配置:
[uwsgi]
plugins=python
vhost=true
socket=127.0.0.1:9001
file=/usr/share/apache2/iredadmin/iredadmin.py
nginx日志:
...
2013/07/30 14:47:04 [error] 15947#0: *56 open() "/usr/share/apache2/roundcubemail/favicon.ico" failed (2: No such file or directory ...
uwsgi 日志:
AttributeError: 'general'
Tue Jul 30 14:36:33 2013 - unable to load app 0 (mountpoint='mail.myserver.com|') (callable not found or import error)
mail.myserver.com [pid: 17788|app: -1|req: -1/2] 146.52.44.87 () {50 vars in 1421 bytes} [Tue Jul 30 14:36:33 2013] GET /iredadmin => generated 48 bytes in 9 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0)
Traceback (most recent call last):
File "/usr/share/apache2/iredadmin/iredadmin.py", line 9, in <module>
from libs import iredbase
File "/usr/share/apache2/iredadmin/libs/iredbase.py", line 34, in <module>
webmaster = cfg.general.get('webmaster', 'root')
File "/usr/lib/python2.7/dist-packages/web/utils.py", line 76, in __getattr__
raise AttributeError, k
AttributeError: 'general'
Tue Jul 30 14:41:31 2013 - unable to load app 0 (mountpoint='mail.myserver.com|') (callable not found or import error)
mail.myserver.com [pid: 17787|app: -1|req: -1/3] 146.52.44.87 () {48 vars in 1390 bytes} [Tue Jul 30 14:41:31 2013] GET /iredadmin => generated 48 bytes in 4 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0)
Traceback (most recent call last):
File "/usr/share/apache2/iredadmin/iredadmin.py", line 9, in <module>
from libs import iredbase
File "/usr/share/apache2/iredadmin/libs/iredbase.py", line 34, in <module>
webmaster = cfg.general.get('webmaster', 'root')
File "/usr/lib/python2.7/dist-packages/web/utils.py", line 76, in __getattr__
raise AttributeError, k
AttributeError: 'general'
Tue Jul 30 14:47:04 2013 - unable to load app 0 (mountpoint='mail.myserver.com|') (callable not found or import error)
mail.myserver.com [pid: 17787|app: -1|req: -1/4] 146.52.44.87 () {50 vars in 1421 bytes} [Tue Jul 30 14:47:04 2013] GET /iredadmin => generated 48 bytes in 6 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0)
(END)