DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 5th December 2019
Scripter Scripter is offline
Port Guard
 
Join Date: Apr 2018
Posts: 12
Default httpd - subfolder access

Subfolder/pages (ie, https://domain.tld/subfolder/index.html) throws a generic "Access Denied" message. I want to make the page available to the internet.

I have permissions set to www:www and 0755 on /var/www/htdocs and all subfolders (which includes /var/www/htdocs/domain.tld). The behavior persists with or without TLS enabled.

Here is the contents of my httpd.conf:
Code:
ext_ip = "egress"

server "default" {
    root "/htdocs/domain.tld"
    listen on $ext_ip port 80
    directory index index.php
    location "*.php" {
        fastcgi socket "//run/php-fpm.sock"
    }
}

Last edited by Scripter; 5th December 2019 at 08:40 PM.
Reply With Quote
  #2   (View Single Post)  
Old 5th December 2019
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

(You've posted this in OpenBSD Packages and Ports. The httpd(8) server is built-in.)

---

I know you're showing only a fragment of your configuration, but all I can see is that the server{} uses a PHP index but does not include a fastcgi directive to interface with with php-fpm.
Reply With Quote
  #3   (View Single Post)  
Old 5th December 2019
Scripter Scripter is offline
Port Guard
 
Join Date: Apr 2018
Posts: 12
Default

Quote:
Originally Posted by jggimi
(You've posted this in OpenBSD Packages and Ports. The httpd(8) server is built-in.)
Whoops -- can this be moved?

Quote:
I know you're showing only a fragment of your configuration, but all I can see is that the server{} uses a PHP index but does not include a fastcgi directive to interface with with php-fpm.
I do have a section for that in the config. I've updated the original post to include it. I was just trying to keep it concise because it was displaying that kind of behavior even with, say, index.html.
Reply With Quote
  #4   (View Single Post)  
Old 6th December 2019
PapaParrot's Avatar
PapaParrot PapaParrot is offline
parrot
 
Join Date: Jul 2015
Location: Durango, Mx.
Posts: 472
Default

Have you tried ?:
Code:
ext_ip = "egress"

server "default" {
    root "/htdocs/domain.tld"
    listen on $ext_ip port 80
    directory index index.html index.php
    location "*.php" {
        fastcgi socket "//run/php-fpm.sock"
    }
}
Or perhaps just the "auto index" option.https://man.openbsd.org/httpd.conf
Quote:
directory option
Set the specified options when serving or accessing directories. Multiple options may be specified within curly braces. Valid options are:

[no] auto index
If no index file is found, automatically generate a directory listing. This is disabled by default.
index string
Set the directory index file. If not specified, it defaults to index.html.
no index
Disable the directory index. httpd(8) will neither display nor generate a directory index.
Since you have specified "index and index.php" only, it might be ignoring the .html
__________________
My best friends are parrots

Last edited by PapaParrot; 6th December 2019 at 01:44 AM.
Reply With Quote
  #5   (View Single Post)  
Old 6th December 2019
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

I'm unable to replicate the problem here. PappaParrot may be on to something if you're not using an exact filename match in /var/www/htdocs/domain.tld/<file>.
Reply With Quote
  #6   (View Single Post)  
Old 6th December 2019
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Hmmm.... I just noticed:
Quote:
(ie, https://domain.tld/subfolder/index.html)
This server{} is not listening for https traffic. It is only listening on port 80, for http:// traffic.
Reply With Quote
  #7   (View Single Post)  
Old 6th December 2019
PapaParrot's Avatar
PapaParrot PapaParrot is offline
parrot
 
Join Date: Jul 2015
Location: Durango, Mx.
Posts: 472
Default

Since I am using "nginx" , I do not have httpd.conf ,nor httpd enabled , so like wise can not check/confirm, just guessing .
__________________
My best friends are parrots
Reply With Quote
  #8   (View Single Post)  
Old 6th December 2019
Scripter Scripter is offline
Port Guard
 
Join Date: Apr 2018
Posts: 12
Default

Thank you for the replies.

Quote:
Originally Posted by PapaParrot
...
Code:
directory index index.html index.php
...Or perhaps just the "auto index" option...
When I try directory index index.html index.php, httpd fails to start/restart. It seems like it only accepts one filename type. auto index technically works, but it's not the behavior I want.

Quote:
Originally Posted by jggimi
I'm unable to replicate the problem here. PappaParrot may be on to something if you're not using an exact filename match in /var/www/htdocs/domain.tld/<file>.
Yeah, I'm finding that if I just use a consistent "index.<extension>", like "index.php", throughout all subfolders, it will work as expected. The problem seems to be a mixing of index.php and index.<otherextensions> -- that seems to be the culprit. Since PapaParrot's suggestion failed, I'm curious if there's a way to specify anything that begins with "index.*" as a way to save time.

Quote:
This server{} is not listening for https traffic. It is only listening on port 80, for http:// traffic.
I had https enabled, but disabled it for testing. The behavior was the same regardless.

Last edited by Scripter; 6th December 2019 at 07:08 PM.
Reply With Quote
  #9   (View Single Post)  
Old 6th December 2019
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

See this October misc@ discussion on intermixing php and html index files.

https://marc.info/?t=157093321800003&r=1&w=2

The TL;DR is "nope." Not in the same location{}.
Reply With Quote
Old 6th December 2019
Scripter Scripter is offline
Port Guard
 
Join Date: Apr 2018
Posts: 12
Default

Quote:
Originally Posted by jggimi View Post
See this October misc@ discussion on intermixing php and html index files.

https://marc.info/?t=157093321800003&r=1&w=2

The TL;DR is "nope." Not in the same location{}.
Thanks for sharing that. Hopefully I won't ever need to use this, but it is good to know.

Marking this "solved": httpd requires a consistent index extension.
Reply With Quote
Old 17th December 2019
victorvas victorvas is offline
Real Name: Victor
Linux
 
Join Date: May 2019
Posts: 148
Default

Code:
server "default" {
    root "/htdocs/domain.tld"
    listen on $ext_ip port 80
    directory index index.php
    location "*.php" {
        fastcgi socket "//run/php-fpm.sock"
    }
    location "/subfolder/*" {
        directory index index.html
    }
}
Try this, it works for me.

Last edited by ocicat; 18th December 2019 at 04:22 AM. Reason: Please use [code] & [/code] tags when posting file contents.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
cms for httpd psypro OpenBSD General 1 9th August 2016 08:51 PM
New httpd and PHP morophla OpenBSD Packages and Ports 21 31st August 2015 09:54 PM
httpd features ? 22decembre OpenBSD General 3 28th March 2015 09:46 PM
httpd in OpenBSD 5.6 jorisvh OpenBSD Packages and Ports 8 4th November 2014 12:14 AM
httpd -DNOHTTPACCEPT starbuck FreeBSD General 9 23rd August 2008 12:14 PM


All times are GMT. The time now is 06:32 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick