Hej zusammen,
bin noch recht neu in der Materie, versuche aber, mir einen Webserver auf einem RasPi B zu installieren. Sobald ich "nginx" frisch installiet habe, läuft via HTTP auch noch alles, wie gewünscht. Sobald SSL ins Spiel kommt, scheine ich etwas falsch zu machen. Ich habe mich jetzt an verschiedensten Anleitungen langgehangelt und finde einfach den Fehler nicht. Ich gebe jetzt mal, was ich habe:
Was ich bisher gemacht habe:
Code
sudo apt-get install nginx php5 php5-fpm php-pear php5-common php5-mcrypt php5-mysql php5-cli php5-gd php-apc mysql-server php5-curl
Danach
Code
sudo sed -i „s/worker_processes 4;/worker_processes 1;/g“ /etc/nginx/nginx.conf
sudo sed -i „s/worker_connections 768;/worker_connections 128;/g“ /etc/nginx/nginx.conf
Swap:
Code
sudo su
sudo echo „CONF_SWAPSIZE=1024“ > /etc/dphys-swapfile
dphys-swapfile setup
dphys-swapfile swapon
exit
Danach habe ich den folgenden Code in die /etc/nginx/sites-available/default kopiert
Code
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
server {
listen 80;
server_name sub.domain.com;
rewrite ^ https://$server_name$request_uri? permanent; # enforce https
}
server {
listen 443 ssl;
server_name sub.domain.com;
ssl_certificate /etc/nginx/server.crt;
ssl_certificate_key /etc/nginx/server.key;
root /var/www/html;
index index.html index.htm index.php;
client_max_body_size 10G; # set max upload size
fastcgi_buffers 64 4K;
rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
error_page 403 = /core/templates/403.php;
error_page 404 = /core/templates/404.php;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ ^/owncloud/(data|config|\.ht|db_structure\.xml|README) {
deny all;
}
location / {
rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
try_files $uri $uri/ index.php;
}
location ~ ^(.+?\.php)(/.*)?$ {
try_files $1 = 404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$1;
fastcgi_param PATH_INFO $2;
fastcgi_param HTTPS on;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ~* ^.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
# Optional: Don't log access to assets
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Alles anzeigen
Und seitdem kann ich den nginx service starten.
Code
root@raspi-nginx:/# systemctl status nginx.service -l
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
Active: failed (Result: exit-code) since Sa 2016-03-12 19:05:35 CET; 48s ago
Process: 13487 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 14571 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Main PID: 10519 (code=exited, status=0/SUCCESS)
Mär 12 19:05:35 raspi-nginx nginx[14571]: nginx: [emerg] no "events" section in configuration
Mär 12 19:05:35 raspi-nginx nginx[14571]: nginx: configuration file /etc/nginx/nginx.conf test failed
Mär 12 19:05:35 raspi-nginx systemd[1]: nginx.service: control process exited, code=exited status=1
Mär 12 19:05:35 raspi-nginx systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Mär 12 19:05:35 raspi-nginx systemd[1]: Unit nginx.service entered failed state.
root@raspi-nginx:/# journalctl -xn -l
-- Logs begin at Sa 2016-03-12 15:15:40 CET, end at Sa 2016-03-12 19:05:42 CET. --
Mär 12 19:05:35 raspi-nginx sudo[14554]: pam_unix(sudo:session): session opened for user root by pi(uid=0)
Mär 12 19:05:35 raspi-nginx systemd[1]: Starting A high performance web server and a reverse proxy server...
-- Subject: Unit nginx.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has begun starting up.
Mär 12 19:05:35 raspi-nginx nginx[14571]: nginx: [emerg] no "events" section in configuration
Mär 12 19:05:35 raspi-nginx nginx[14571]: nginx: configuration file /etc/nginx/nginx.conf test failed
Mär 12 19:05:35 raspi-nginx systemd[1]: nginx.service: control process exited, code=exited status=1
Mär 12 19:05:35 raspi-nginx systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit nginx.service has failed.
--
-- The result is failed.
Mär 12 19:05:35 raspi-nginx systemd[1]: Unit nginx.service entered failed state.
Mär 12 19:05:35 raspi-nginx sudo[14554]: pam_unix(sudo:session): session closed for user root
Mär 12 19:05:42 raspi-nginx sudo[14599]: pi : TTY=pts/0 ; PWD=/ ; USER=root ; COMMAND=/bin/bash
Mär 12 19:05:42 raspi-nginx sudo[14599]: pam_unix(sudo:session): session opened for user root by pi(uid=0)
root@raspi-nginx:/#
Alles anzeigen
Weiß jemand Rat? Ziel ist, einen SSL-fähigen Webserver einzurichten, auf dem ich später Webseiten laufen lassen kann.
Vielen Dank im Voraus...
LG // nephilim75