Home php Instead of the page returns file list (index of /)

Instead of the page returns file list (index of /)

Author

Date

Category

I do not know the PHP Tolsticks does not work Poli xs).
Although the php -v team
Returns the result

[root @ 94 www] # php -v

PHP 7.2.20 (BUILT) (Built: Jul 2 2019 13:01:19) (NTS)
Copyright (C) 1997-2018 The PHP GROUP
Zend Engine V3.2.0, Copyright (C) 1998-2018 Zend Technologies

My CentOS 6: Apache + NGIX + PHP

Here is my nginx conf

server {
 LISTEN 80;
 Server_Name Emrdeveloper.ru www.emrdeveloper.ru;
 #access_log /var/log/nginx/vps_access.log;
 location ~ * \. (JPG | JPEG | GIF | PNG | ICO | CSS | BMP | SWF | js | doc | docx | pdf | xls | xlsx | rar | zip | TBZ | 7Z | EXE) $ {
 root / var / www / tracex / public /;
 EXPIRES 10D;
 }
 location ~ /.ht {
   DENY ALL;
 }
 location = / STAT {
 Stub_status ON;
 Access_log Off;
# Allow xx.xx.xx.xx;
# Deny All;
         }
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_redirect off;
log_not_found off;
proxy_set_header X-REAL-IP $ remote_addr;
proxy_set_header host $ http_host;
proxy_set_header X-FORWARDED-FOR $ proxy_add_x_forwarded_for;
}

}

and httpd.conf

& lt; virtualhost *: 8080 & gt;
 ServerName Emrdeveloper.ru.
 Serveralias www.Emrdeveloper.ru.
  Documentroot / Var / WWW / TRACEX / Public
& lt; directory "/ var / www / tracex / public" & gt;
 Options Indexes FollowSymLinks.
 AllowOverride none
& lt; / directory & gt;
& lt; / virtualhost & gt;

Now does not handle PHP


Answer 1

This happens because Apache does not know how to handle PHP files.
in httpd.conf Add:

include conf.modules.d / *. Conf
IncludeOptional conf.d / *. Conf

And there /etc/httpd/conf.d should be file (once you installed PHP) php.conf
in which it is written what to do with PHP files

AddType text / html .php
& lt; iFModule mod_php7.c & gt;
 & lt; FilesMatch \. (PHP | PHAR) $ & gt;
   SetHandler Application / X-Httpd-PHP
 & lt; / filesmatch & gt;
 #
 # UNCOMMENT THE FOLLOWING LINES TO ALLOW PHP TO PRETTY-PRINT .PHPS
 # Files AS PHP Source Code:
 #
 # & lt; FilesMatch \ .PHPS $ & gt;
 # SetHandler Application / X-Httpd-PHP-Source
 # & lt; / filesmatch & gt;
 #
 # Apache Specific PHP Configuration Options
 # THOSE CAN BE OVERRIDE IN EACH CONFIGURED VHOST
 #
 PHP_VALUE session.save_handler "Files"
 php_value session.save_path "/ var / lib / php / session"
 php_value saap.wsdl_cache_dir "/ var / lib / php / wsdlcache"
 #PHP_VALUE opcache.file_cache "/ Var / Lib / PHP / OPCACHE"
& lt; / iFModule & gt;

or add it to httpd.conf.


Answer 2, Authority 100%

Try to say Apache that when requesting this directory, you need to call certain files and restart Apache

& lt; virtualhost *: 8080 & gt;
 ServerName Emrdeveloper.ru.
 Serveralias www.Emrdeveloper.ru.
  Documentroot / Var / WWW / TRACEX / Public
& lt; directory "/ var / www / tracex / public" & gt;
 Options Indexes FollowSymLinks.
 Require all granted
 AllowOverride All.
 DirectoryIndex index.php index.html
& lt; / directory & gt;
& lt; / virtualhost & gt;

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions