0

I have this little issue with configuration of NGINX virtual hosts. I had all nonexistent subdomains pointing to one static HTML file, that was served.

I have deleted that static HTML file, and added GravCMS to domain. There is an installation from Git

root@vps:~# ls -la /var/www/html/blog/
total 259
drwxr-xr-x 16 peter    www-data     30 Mar  7 23:18 .
drwxr-xr-x  6 www-data root          8 Mar  6 17:06 ..
-rwxr-xr-x  1 peter    www-data   1002 Mar  6 17:02 .dependencies
-rwxr-xr-x  1 peter    www-data    359 Mar  6 17:02 .editorconfig
drwxr-xr-x  8 peter    www-data     13 Mar  6 17:02 .git
-rwxr-xr-x  1 peter    www-data    539 Mar  6 17:02 .gitignore
-rwxr-xr-x  1 peter    www-data   3034 Mar  6 17:02 .htaccess
-rwxr-xr-x  1 peter    www-data   4791 Mar  6 17:02 .travis.yml
drwxr-xr-x  2 peter    www-data      2 Oct 20 13:06 .well-known
-rwxr-xr-x  1 peter    www-data  79258 Mar  6 17:02 CHANGELOG.md
-rwxr-xr-x  1 peter    www-data   6389 Mar  6 17:02 CONTRIBUTING.md
-rwxr-xr-x  1 peter    www-data   1071 Mar  6 17:02 LICENSE.txt
-rwxr-xr-x  1 peter    www-data  15368 Mar  6 17:02 README.md
drwxr-xr-x  2 peter    www-data      3 Mar  6 17:02 assets
drwxr-xr-x  2 peter    www-data      3 Mar  6 17:02 backup
drwxr-xr-x  2 peter    www-data      6 Mar  6 17:02 bin
drwxr-xr-x  5 peter    www-data      6 Mar  6 17:56 cache
-rwxr-xr-x  1 peter    www-data    302 Mar  6 17:02 codeception.yml
-rwxr-xr-x  1 peter    www-data   1832 Mar  6 17:02 composer.json
-rwxr-xr-x  1 peter    www-data 111475 Mar  6 17:02 composer.lock
drwxr-xr-x  2 peter    www-data      3 Mar  6 17:02 images
-rwxr-xr-x  1 peter    www-data   1545 Mar  6 17:02 index.php
drwxr-xr-x  2 peter    www-data      3 Mar  6 17:02 logs
-rwxr-xr-x  1 peter    www-data    197 Mar  6 17:02 robots.txt
drwxr-xr-x  9 peter    www-data     11 Mar  6 17:02 system
drwxr-xr-x  7 peter    www-data     11 Mar  6 17:02 tests
drwxr-xr-x  2 peter    www-data      3 Mar  6 17:56 tmp
drwxr-xr-x  8 peter    www-data      8 Mar  6 17:02 user
drwxr-xr-x 20 peter    users        21 Mar  6 17:53 vendor
drwxr-xr-x  2 peter    www-data      8 Mar  6 17:02 webserver-configs

And this is a vhost config:

server {
listen 80;
index index.html index.php;

## Begin - Server Info
root /var/www/html/blog;
server_name pbocan.net;
## End - Server Info

access_log /var/log/nginx/blog.log;

## Begin - Index
# for subfolders, simply adjust:
# `location /subfolder {`
# and the rewrite to use `/subfolder/index.php`
location / {
    try_files $uri $uri/ /index.php?_url=$uri&$query_string;
}
## End - Index

## Begin - Security
# deny all direct access for these folders
location ~* /(.git|cache|bin|logs|backup|tests)/.*$ { return 403; }
# deny running scripts inside core system folders
location ~* /(system|vendor)/.*\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
# deny running scripts inside user folder
location ~* /user/.*\.(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
# deny access to specific files in the root folder
location ~ /(LICENSE.txt|composer.lock|composer.json|nginx.conf|web.config|htaccess.txt|\.htaccess) { return 403; }
## End - Security

## Begin - PHP
location ~ \.php$ {
    # Choose either a socket or TCP/IP address
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    # fastcgi_pass 127.0.0.1:9000;

    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
## End - PHP
}

Yet I am being served, now nonexistent, HTML file. I am using NGINX 1.6.2

6
  • Did you restart nginx? Mar 8, 2017 at 0:24
  • Many times, and many times it failed.
    – PeterBocan
    Mar 8, 2017 at 0:26
  • It failed to restart? OK, you should fix the problem that causes it to not restart. Mar 8, 2017 at 0:26
  • Many times it failed to achieve any difference, not that it did not failed to restart.
    – PeterBocan
    Mar 8, 2017 at 0:28
  • You need to be more specific when describing things. Right now we can't tell exactly what the cause of the problem is, and there's a lot missing from your question. So, please post somewhere the output from nginx -T which should show your actual configuration. Mar 8, 2017 at 0:31

0

You must log in to answer this question.

Browse other questions tagged .