My Requirements
Ghost Blog on www.mydomain.com/blog
An index.html, contact.php, couple of images and js files in root directory. (i.e something like www.mydomain.com/index.html, mydomain.com/contact.php, etc)
After Reading This Tutorial https://www.digitalocean.com/community/tutorials/how-to-create-a-blog-with-ghost-and-nginx-on-ubuntu-14-04 , I m able to run ghost on www.mydomain.com/blog. But Unfortunately, I Cant Access anything from root directory i.e. www.mydomain.com as it throws a 404 Error
Prior to Ghost Install Everything inside /usr/share/nginx/www
was available on root directory. Now, I used ls
command to check whether the files are present inside folder /usr/share/nginx/www
and I can View these files on my terminal.
When I cd
to /etc/nginx/sites-available/
folder, I can see 2 files ghost and default and inside /etc/nginx/sites-enabled/
I can see only ghost file.
When I copy the default file from /etc/nginx/sites-available/
to /etc/nginx/sites-enabled/
, Ghost Blog gives a 404 Error.
Here is The default file Content server { listen 80 default_server; listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
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;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
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;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
Here is The ghost file Content
server {
listen 80;
server_name SERVERIP/spider;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:2368;
}
}