New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config.php not found #2312

Closed
mitchya1 opened this Issue Nov 1, 2017 · 11 comments

Comments

Projects
None yet
6 participants
@mitchya1

mitchya1 commented Nov 1, 2017

Hello all,

I seem to be stuck getting nginx to display my YOURLS page. The nginx error.log reads:

*1 directory index of "/var/www/site/" is forbidden, client: IP.IP.IP.IP, server: site.com, request: "GET / HTTP/1.1", host: "site.com"

I've altered some information for privacy.

When I head to my site, I get a 403 message. However, if I enable autoindex in /etc/nginx/sites-available/myYOURLS.com (which is symlinked to /sites-enabled/), everything shows up.

The permissions are 755 on /var/www/site and www-data:www-data owns var/www.

My /sites-available/ config is this:

server {

listen 80;

server_name site.com;

root /var/www/site.com;

#index index.php;

location / {
try_files $uri $uri/ /yourls-loader.php;
#autoindex on;
expires 14d;
add_header Cache-Control 'public';
}

location ~ \.php$ {
  try_files $uri =404;
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  fastcgi_pass unix:/var/run/php/php7.0-fpm-ubuntu.sock;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include fastcgi_params;

}
}

Ubuntu 16.04.3
nginx 1.12.1

  • YOURLS version: Latest. I cloned it (again) today.
    • Plugins enabled: None
  • PHP version: 7.0

Most of the above config came from the YOURLS wiki. I've tried explicitly specifying the yourls-loader.php location to no avail. Although I'm honestly not quite sure what the does. I'm sure I'm missing something simple, but this I'm very new to this.

No quite sure where I need to go from here. Thanks in advance!

@LeoColomb

This comment has been minimized.

Show comment
Hide comment
@LeoColomb

LeoColomb Nov 1, 2017

Member

Duplicate of #2311

Definitely something wrong with #2294, ping @ozh for review.

Member

LeoColomb commented Nov 1, 2017

Duplicate of #2311

Definitely something wrong with #2294, ping @ozh for review.

@LeoColomb

This comment has been minimized.

Show comment
Hide comment
@LeoColomb

LeoColomb Nov 1, 2017

Member

Testing and everything works perfectly for me, even from scratch and from php cli server.
Weird...

Edit: Some wrong thinking removed. Sorry to close reopen.

Member

LeoColomb commented Nov 1, 2017

Testing and everything works perfectly for me, even from scratch and from php cli server.
Weird...

Edit: Some wrong thinking removed. Sorry to close reopen.

@LeoColomb LeoColomb closed this Nov 1, 2017

@LeoColomb LeoColomb reopened this Nov 2, 2017

@LeoColomb LeoColomb added bug core labels Nov 2, 2017

@KabataMacharia

This comment has been minimized.

Show comment
Hide comment
@KabataMacharia

KabataMacharia commented Nov 2, 2017

+1

@KabataMacharia

This comment has been minimized.

Show comment
Hide comment
@KabataMacharia

KabataMacharia Nov 2, 2017

On windows, this error is not present.
On Linux, I changed this file
includes/YOURLS/Config/Config.php
here are the changes

public function __construct($config = false) {
        $this->set_root(realpath(dirname(dirname(dirname(dirname(__FILE__))))) );
        //$this->fix_win32_path(realpath(__DIR__ . '../../../..')) //This does not work on linux but on windows
        $this->set_config($config);
 }

This now works for me.
Hope this will helps in the bug correction during next update....

KabataMacharia commented Nov 2, 2017

On windows, this error is not present.
On Linux, I changed this file
includes/YOURLS/Config/Config.php
here are the changes

public function __construct($config = false) {
        $this->set_root(realpath(dirname(dirname(dirname(dirname(__FILE__))))) );
        //$this->fix_win32_path(realpath(__DIR__ . '../../../..')) //This does not work on linux but on windows
        $this->set_config($config);
 }

This now works for me.
Hope this will helps in the bug correction during next update....

@LeoColomb

This comment has been minimized.

Show comment
Hide comment
@LeoColomb

LeoColomb Nov 2, 2017

Member

@KabataMacharia Good catch, thanks for your feedback! 👍
Can you submit a pull request with this change? Thx!

Member

LeoColomb commented Nov 2, 2017

@KabataMacharia Good catch, thanks for your feedback! 👍
Can you submit a pull request with this change? Thx!

LeoColomb added a commit that referenced this issue Nov 2, 2017

@LeoColomb LeoColomb closed this in 4cb866a Nov 2, 2017

@ozh ozh reopened this Nov 3, 2017

@mitchya1

This comment has been minimized.

Show comment
Hide comment
@mitchya1

mitchya1 Nov 3, 2017

Update.

I pulled the latest update but am still having issues. I stopped nginx and installed Apache2 today. I get a 403 forbidden error on the page and this output in the Apache2 error.log:

AH01276: Cannot serve directory /var/www/site.com/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive

If I go to /admin in a browser, (or anywhere besides the root)m, the index.php displays as plain text.
I've purged and reinstalled PHP as well in case there was an issue there.

sites-enabled config:

<VirtualHost *:80>
   ServerName urls.magicmemories.com
   DocumentRoot /var/www/site.com
   DirectoryIndex index.php index.html
   <Directory /var/www/site.com/>
      AllowOverride All
      Order Deny,Allow
      Allow from all
   </Directory>
</VirtualHost>

.htaccess:

#BEGIN YOURLS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /yourls-loader.php [L]
</IfModule>
#END YOURLS
#BEGIN INDEX-FIX
Options -Indexes
DirectoryIndex index.php index.html
#END INDEX-FIX

mitchya1 commented Nov 3, 2017

Update.

I pulled the latest update but am still having issues. I stopped nginx and installed Apache2 today. I get a 403 forbidden error on the page and this output in the Apache2 error.log:

AH01276: Cannot serve directory /var/www/site.com/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive

If I go to /admin in a browser, (or anywhere besides the root)m, the index.php displays as plain text.
I've purged and reinstalled PHP as well in case there was an issue there.

sites-enabled config:

<VirtualHost *:80>
   ServerName urls.magicmemories.com
   DocumentRoot /var/www/site.com
   DirectoryIndex index.php index.html
   <Directory /var/www/site.com/>
      AllowOverride All
      Order Deny,Allow
      Allow from all
   </Directory>
</VirtualHost>

.htaccess:

#BEGIN YOURLS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /yourls-loader.php [L]
</IfModule>
#END YOURLS
#BEGIN INDEX-FIX
Options -Indexes
DirectoryIndex index.php index.html
#END INDEX-FIX
@demure

This comment has been minimized.

Show comment
Hide comment
@demure

demure Nov 4, 2017

I pulled the latest version today, and am having this issue too:

2017/11/03 19:51:30 [error] 5750#5750: *1990 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught exception 'YOURLS\Exceptions\ConfigException' with message 'Cannot find config.php. Please read the readme.html to learn how to install YOURLS' in /var/www/YOURLS/includes/YOURLS/Config/Config.php:89
Stack trace:
#0 /var/www/YOURLS/includes/load-yourls.php(18): YOURLS\Config\Config->find_config()
#1 /var/www/YOURLS/admin/index.php(3): require_once('/var/www/YOURLS...')
#2 {main}
  thrown in /var/www/YOURLS/includes/YOURLS/Config/Config.php on line 89" while reading response header from upstream, client: REDACTED, server: ln.demu.red, request: "GET /admin/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "ln.demu.red"

demure commented Nov 4, 2017

I pulled the latest version today, and am having this issue too:

2017/11/03 19:51:30 [error] 5750#5750: *1990 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught exception 'YOURLS\Exceptions\ConfigException' with message 'Cannot find config.php. Please read the readme.html to learn how to install YOURLS' in /var/www/YOURLS/includes/YOURLS/Config/Config.php:89
Stack trace:
#0 /var/www/YOURLS/includes/load-yourls.php(18): YOURLS\Config\Config->find_config()
#1 /var/www/YOURLS/admin/index.php(3): require_once('/var/www/YOURLS...')
#2 {main}
  thrown in /var/www/YOURLS/includes/YOURLS/Config/Config.php on line 89" while reading response header from upstream, client: REDACTED, server: ln.demu.red, request: "GET /admin/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "ln.demu.red"
@leachim6

This comment has been minimized.

Show comment
Hide comment
@leachim6

leachim6 Nov 4, 2017

I'm also having this same issue

nginx version: nginx/1.13.6 built by gcc 6.3.0 20170516 (Debian 6.3.0-18) built with OpenSSL 1.1.0f 25 May 2017 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.13.6/debian/debuild-base/nginx-1.13.6=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

$ php7.0 -v PHP 7.0.19-1 (cli) (built: May 11 2017 14:04:47) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.19-1, Copyright (c) 1999-2017, by Zend Technologies

$ mysql -V mysql Ver 15.1 Distrib 10.1.26-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

leachim6 commented Nov 4, 2017

I'm also having this same issue

nginx version: nginx/1.13.6 built by gcc 6.3.0 20170516 (Debian 6.3.0-18) built with OpenSSL 1.1.0f 25 May 2017 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/data/builder/debuild/nginx-1.13.6/debian/debuild-base/nginx-1.13.6=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

$ php7.0 -v PHP 7.0.19-1 (cli) (built: May 11 2017 14:04:47) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.19-1, Copyright (c) 1999-2017, by Zend Technologies

$ mysql -V mysql Ver 15.1 Distrib 10.1.26-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

@ozh

This comment has been minimized.

Show comment
Hide comment
@ozh

ozh Nov 4, 2017

Member

Guys, this issue is a mess. There are nginx problems and then "config not found" problems, all mixed.

nginx : is it working with 1.7.2 downloaded from the archive?

Config not found: please try patch from PR 2314

Closing this. Feel free to submit another precise issue with one clearly described problem. Thanks all.

Member

ozh commented Nov 4, 2017

Guys, this issue is a mess. There are nginx problems and then "config not found" problems, all mixed.

nginx : is it working with 1.7.2 downloaded from the archive?

Config not found: please try patch from PR 2314

Closing this. Feel free to submit another precise issue with one clearly described problem. Thanks all.

@ozh ozh closed this Nov 4, 2017

@demure

This comment has been minimized.

Show comment
Hide comment
@demure

demure Nov 12, 2017

The git pull I did today has restored functionality. Thanks.

demure commented Nov 12, 2017

The git pull I did today has restored functionality. Thanks.

@mitchya1

This comment has been minimized.

Show comment
Hide comment
@mitchya1

mitchya1 Dec 19, 2017

Regarding the original issue, I know this is closed but I finally got it working.

I ended up changing:
public function __construct($config = false) { $this->set_root(realpath(dirname(dirname(dirname(dirname(__FILE__))))) ); //$this->fix_win32_path(realpath(__DIR__ . '../../../..')) //This does not work on linux but on windows $this->set_config($config); }

To this:
public function __construct($config = false) { $this->set_root('/path/to/doc/root'); //$this->fix_win32_path(realpath(__DIR__ . '../../../..')) //This does not work on linux but on windows $this->set_config($config); }

Now it's working!

mitchya1 commented Dec 19, 2017

Regarding the original issue, I know this is closed but I finally got it working.

I ended up changing:
public function __construct($config = false) { $this->set_root(realpath(dirname(dirname(dirname(dirname(__FILE__))))) ); //$this->fix_win32_path(realpath(__DIR__ . '../../../..')) //This does not work on linux but on windows $this->set_config($config); }

To this:
public function __construct($config = false) { $this->set_root('/path/to/doc/root'); //$this->fix_win32_path(realpath(__DIR__ . '../../../..')) //This does not work on linux but on windows $this->set_config($config); }

Now it's working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment