Just fnished the last Chapter of JumpStartPHPEnv and it didn't go well

I followed the instruction(I mean, fully) and it turned out like this

what the problem it might be?

I do not own the book so I do not know what the final goal here is but Iā€™d say that if the exercise was to install the nginx web server than you were successful.
If the above text is what you see in your web browser pointed to localhost or whatever domain that this install lives on than it seems like youā€™ve succeeded.

Why do you think thereā€™s an issue here?

Steve

No,the final goal is to deploy an application on Digitalocean,and Iā€™ve done what need to be done,it still looks like that,my application wasnā€™t there.

Okay, I understand now. (I think)

You deployed an app but when you surf to the domain on DO, you still see the test page placed in the document root by the nginx install correct?

My suggestion would be to check to see where you application is installed to. Ensure you didnā€™t inadvertently have the app installed into your /home/ directory.

Next check to ensure that you app is in fact in the document root for that particular install of nginx. Generally something like /var/www or /var/www/html
If you app is inside a folder on DO you may need to change the uri in your browser. For example if your app is named ā€œawesomeā€ it could very well live inside a folder named ā€œawesomeā€ so in your URI you might have something like http://yourdomain.com/awesome/

Another suggestion is to open up a terminal window to your DO domain and look at the files in the document root for the web server. Either use SSH or do so through the DO management page over on the right side, across from your droplet name in the drop down menu that says ā€œMoreā€ then access console.

Steve

1 Like

Sorry,but none of your suggestions work,and you did point out where the problem might be,and I found several mistakes in the serverā€™s configuration file but then it still the way it was

this is the contents of the configuration file:

server {
    listen 80;
    listen 443 ssl;
    server_name 188.166.211.224;
    root "/var/www/guestbook/public";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/guestbook.app-error.log error;

    sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
    }

    location ~ /\.ht {
        deny all;
    }

}

donā€™t know whether thereā€™s some other problems I didnā€™t notice.

Hi Akido,

At this point I am unsure as to what might be causing the issue you are seeing. Iā€™m guessing your not having a permission issue correct?

I do not have a copy of the book but Iā€™m making a guess that your app is some sort of guestbook and that the app lives under /var/www/ right, with the index.php file located at /var/www/guestbook/public/? (Iā€™m taking this from your nginx config file you posted).

Iā€™m not very familiar with nginx, I doubt Iā€™d be able to trouble shoot an issue with the web server.

If you created a new php file in this directory using perhaps vim can you point your browser at this file and see it?
(try something like: <?php phpinfo(); ?>
This will also verify that you have PHP installed too.

The author of the book frequents these forums, maybe he could offer some advice??? :slight_smile:

Steve

Your guesses about my application is right.

it looks like this

just a stupid little demo,you can leave a comment and it will displayed above.

And I realized that the thing is that I canā€™t access my applicationā€™s root file at all,because I deleted the default setting of the web server(which located the same directory as the guestbook.appā€“the serverā€™s configuration file of my application I copied from the development environment-- at /etc/nginx/sites-available/),and the 188.166.211.224 is now not reachable.

Youā€™ve helped me a lot,I really appreciate it,wish you a good dayšŸ˜¬.

Oh,you mentioned permission,the bookā€™s guide like this

d /var/www/guestbook 
sudo chown -R :www-data . 
sudo chmod -R 775 storage

I thought it must be cd,and donā€™t know why thereā€™s a dot the second line.I ran it for two times.Is the instruction right?
/storage is a directory I put database files in it.

My first thought was default files. This line in the nginx config:

index index.html index.htm index.php;

Has the index.html listed before index.php. It could be that if you forgot to delete the default html index file, itā€™s simply ignoring your own index php file.

You should be deleting any default files and replacing them with your own appā€™s index file.

I already did that,but thanks.

Iā€™ll take a more detailed look asap, sorry about that - but Iā€™m currently at conferences and moving apartments so a bit strapped for time. Iā€™ll do it as soon as I can, I promise!

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.