我创建了一个在nginx上运行Pelican的Web服务器。这是我的网站服务器的配置文件,包含在/etc/nginx/sites-available/larryfritts.com中:
server {
server_name www.larryfritts.com;
# Rewrite www to non-www
rewrite ^(.*) http://larryfritts.com$1 permanent;
}
server {
# Listening ports
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80; ## listen for ipv6
# Make site accessible from domain
server_name larryfritts.com;
# Root directory
root /var/www/larryfritts.com/public_html;
index index.html index.htm index.php;
# Logs
access_log /var/www/larryfritts.com/logs/access.log;
error_log /var/www/larryfritts.com/logs/error.log;
# Includes
include global/restrictions.conf;
}
一切都很好。我决定添加一个邮件服务器和roundcube,因此为roundcube创建了另一个配置文件。这可以在/ etc / nginx / sites-available / roundcube中找到:
server {
server_name mail.larryfritts.com;
listen 80;
return 301 https://mail.yourdomain.com$request_uri;
}
server {
server_name mail.larryfritts.com;
listen 80;
return 301 https://$host$request_uri;
}
# HTTPS server
server {
listen 443 ssl spdy default_server;
server_name mail.larryfritts.com;
root /usr/share/nginx/roundcube;
index index.html index.php;
autoindex off;
ssl on;
ssl_certificate /etc/ssl/private/ssl-chain-mail-larryfritts.pem;
ssl_certificate_key /etc/ssl/private/ssl-key-decrypted-mail-larryfritts.key;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1 SSLv3;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AES:RSA+3DES:!ADH:!AECDH:!MD5:!DSS;
ssl_prefer_server_ciphers on;
ssl_ecdh_curve secp521r1;
# Client auth via certs
# ssl_client_certificate /etc/ssl/private/yourdomain.crt;
# ssl_trusted_certificate /etc/ssl/private/yourdomain.crt;
# ssl_verify_client on;
location / {
# if ($ssl_client_s_dn !~* "you@yourdomain.com") {
# return 301 http://www.jurassicsystems.com/;
# }
# error_page 403 @fallback;
}
location ~ ^/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
deny all;
}
location ~ ^/(bin|SQL)/ {
deny all;
}
location ~ ^/.*\.php {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php5-fpm-sock;
fastcgi_param HTTPS on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
这两个文件都与sym链接到/ etc / nginx / sites-enabled /
当我尝试重新启动nginx时,我遇到了失败:
service nginx restart
* Restarting nginx nginx [fail]
我假设我的两个配置文件中存在冲突,但这是我设置的第一台服务器,我还不太了解它。