So I tried following this guide, but seems to fail at this step. When accessing the /index.php my browser(both chromium and firefox) downloaded the page as a file, then I decided to delete the file from sites-available and begin from the default file again, now it doesnt download the site but just shows a plain white site with no source code.
I am pretty sure its just me who screwed something up in the code. Here is my nginx conf from sites-available:
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
root /data/randomsite10101.org/www;
# Add index.php to the list if you are using PHP
index index.html index.htm index.php index.nginx-debian.html;
server_name randomsite10101.org.local randomsite10101.org;
error_log /data/randomsite10101.org/logs/error.log error;
access_log /data/randomsite10101.org/logs/access.log;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location ~ [^/].php(/|$) {
fastcgi_split_path_info ^(.+?.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
New config:
# Default server configuration
#
server {
listen 80 default_server;
#listen [::]:80 default_server;
error_log /data/randomsite10101.org/logs/error.log error;
access_log /data/randomsite10101.org/logs/access.log;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /data/randomsite10101.com/www;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name randomsite10101.org;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
#}
location ~ \.php$ {
fastcgi_split_path_info ^(.+?.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/randomsite10101.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/randomsite10101.org/privkey.pem; # managed by Certbot
ssl_session_cache shared:le_nginx_SSL:1m; # managed by Certbot
ssl_session_timeout 1440m; # managed by Certbot
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # managed by Certbot
ssl_prefer_server_ciphers on; # managed by Certbot
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES128-SHA ECDHE-ECDSA-AES256-SHA ECDHE-ECDSA-AES128-SHA256 ECDHE-ECDSA-AES256-SHA384 ECDHE-RSA-AES128-GCM-SHA256 ECDHE-RSA-AES256-GCM-SHA384 ECDHE-RSA-AES128-SHA ECDHE-RSA-AES128-SHA256 ECDHE-RSA-AES256-SHA384 DHE-RSA-AES128-GCM-SHA256 DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES128-SHA DHE-RSA-AES256-SHA DHE-RSA-AES128-SHA256 DHE-RSA-AES256-SHA256 EDH-RSA-DES-CBC3-SHA"; # managed by Certbot
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
David Cullen asked me for the output from ls -hl /data/sitename.com/www/
:
-rw-r--r-- 1 www-data www-data 8 Jan 9 04:10 index.html
-rw-r--r-- 1 root root 21 Jan 9 04:20 index.php
Then I tried to chown the folder to www-data
with following command:
$ sudo chown -R www-data:www-data /data/randomsite.com/www/
And my output is now:
-rw-r--r-- 1 www-data www-data 8 Jan 9 04:10 index.html
-rw-r--r-- 1 www-data www-data 21 Jan 9 04:20 index.php
But it's still not working.
David asked me to remove the index.html, and with only index.php it still shows an empty page.
He asked me to comment some line out aswell and edit my index.php file, both tings done and still empty page.