D
D
Dmitry Cherednichenko2014-12-08 15:27:07
Nginx
Dmitry Cherednichenko, 2014-12-08 15:27:07

Why doesn't Apache see directories?

Hello! Apache doesn't see directories other than root. Permissions 777.
The site is loaded by the main site address, but not by subdirectories, for example /phpmyadmin. Although if you write the path with the index /phpmyadmin/index.php, then it loads normally. Also, do not load pages like /wp-content/uploads/2014/11/rock-Still21.jpg.
httpd.conf

<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>

...

<Directory "/var/www/html">

...

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>

...

NameVirtualHost *:8080
...

<VirtualHost *:8080>
    ServerAdmin [email protected]
    DocumentRoot /var/www/html
    ServerName 2a01:4f8:d13:3d0c::2
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

...

Alias /error/ "/var/www/error/"

<IfModule mod_negotiation.c>
<IfModule mod_include.c>
    <Directory "/var/www/error">
        AllowOverride None
        Options IncludesNoExec
        AddOutputFilter Includes html
        AddHandler type-map var
        Order allow,deny
        Allow from all
        LanguagePriority en es de fr
        ForceLanguagePriority Prefer Fallback
    </Directory>

...

nginx.conf
user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/sites-enabled/*.conf;
  include /etc/nginx/conf.d/*.conf;
  
}

default.conf
server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
        root   /var/www/html;
        index  index.php index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    location ~ \.php$ {
        proxy_pass   http://127.0.0.1:8080;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
        #root           html;
        #fastcgi_pass   127.0.0.1:9000;
        #fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;
        #include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

cfg.conf
server {
  listen *:80; ## listen for ipv4
  server_name localhost;
  access_log /var/log/nginx/access.log;
  
  # Перенаправление на back-end
  location / {
    proxy_pass localhost:8080/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_connect_timeout 120;
    proxy_send_timeout 120;
    proxy_read_timeout 180;
  }
  
  location ~* \.(jpg|jpeg|gif|png|ico|css|bmp|swf|js|html|txt)$ {
    root /var/www/html;
    index  index.php index.html index.htm;
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Kovpashko, 2014-12-11
@sainttechnik

First, turn off the default config. You have the same server name on the same port in default.conf and cfg.conf.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question