|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
||||
OpenBsd server
I am planning to start a server powered with OpenBsd.
So am wondering who else has actual experience with Open Bsd powered server, any thing special I may need to know, etc. I am experimenting first using localhost, and all ready ran into some problems installing php, and maria db , don't have my details handy at the moment, but in a nut shell, a tutorial I was using showed some scripts that need to be in the httpd.conf file, but it was not to clear on exactly where, in any event , when I pasted the code in, it broke the "httpd.conf" and it would not start. I will post the details shortly. My thoughts are maybe the tutorial was not as good as it looked, so any pointers to a good tutorial, would be appreciated. There are a lot of them in my search results, I have not yet read each one, ... So any way, for now that is about it. One last note , I plan to install phpBB, as a forum software, has anyone else done this ? If there is any suggestions for a different forum software, I am open to other ideas. Thanks PS, I have some additional thoughts, ideas,...but will get into that later.
__________________
My best friends are parrots |
|
||||
This is the tutorial I was using last night:
( I do notice, it is a little "old", I am using OpenBsd 6.1, don't know if that is why it would not work for me) https://www.rootbsd.net/kb/339/Insta...penBSD-59.html This is the code, it says to add to my httpd.conf: Quote:
Code:
server "default" { listen on egress port 80 } types { text/css css text/html html htm text/txt txt image/gif gif image/jpeg jpeg jpg image/png png application/javascript js application/xml xml } Quote:
Code:
directory { index "index.php" } My actual httpd.conf file, and it works fine for just regular html, (index.html) Code:
# $OpenBSD: httpd.conf,v 1.16 2016/09/17 20:05:59 tj Exp $ # # Macros # ext_addr="*" # # Global Options # # prefork 3 # # Servers # # A minimal default server server "default" { listen on $ext_addr port 80 } ### This is where I added to code from the tutorial ### Then the additional #directory { # index "index.php" #} # Of course I did not have the # comment symbols, in the actual code, the lines were not #commented out. # Include MIME types instead of the built-in ones types { include "/usr/share/misc/mime.types" } other then "failed". Code:
# $OpenBSD: httpd.conf,v 1.16 2016/09/17 20:05:59 tj Exp $ # # Macros # ext_addr="*" # # Global Options # # prefork 3 # # Servers # # A minimal default server server "default" { listen on $ext_addr port 80 } server "default" { listen on egress port 80 } types { text/css css text/html html htm text/txt txt image/gif gif image/jpeg jpeg jpg image/png png application/javascript js application/xml xml } directory { index "index.php" } # Include MIME types instead of the built-in ones types { include "/usr/share/misc/mime.types" }
__________________
My best friends are parrots |
|
||||
Thanks, and yes, it will be a web server, sorry I didn't think to specify that.
---------- edited -------- thanks , using the -d option gave me enough information to find and fix the lines as needed, it now does access the index.php . ------- edited ----------- This is what my httpd.conf is now: Code:
# $OpenBSD: httpd.conf,v 1.16 2016/09/17 20:05:59 tj Exp $ # # Macros # ext_addr="*" # # Global Options # # prefork 3 # # Servers # # A minimal default server server "default" { listen on $ext_addr port 80 directory { index "index.php" } location "*.php" { fastcgi socket "/run/php-fpm.sock" } } types { text/css css text/html html htm text/txt txt image/gif gif image/jpeg jpeg jpg image/png png application/javascript js application/xml xml } Thanks again Last edited by PapaParrot; 16th July 2017 at 02:20 AM. |
|
||||
However, ran into some problems installing phpmyadmin:
================= In any event the basic "site" is working fine. I have all ways had problems understanding setting up the data base,phpmyadmin, etc. It is not really a problem with OpenBsd, OpenBsd is working great, the problem is just me. I don't remember what I did on the Linux server, but did have similar problems with my initial setup. Anyway, I don't think fixing it will be the same as it was on the other OS, any way, I am finding enough documentation, just need to read more of it
__________________
My best friends are parrots Last edited by PapaParrot; 17th July 2017 at 04:17 AM. |
|
||||
I've never used phpMyAdmin, so don't have specific advice. It has a run dependency of mariadb-client. You will need to install and provision mariadb-server on this local system or provision a connection to your MySQL/MariaDB database system if it is running on another platform.
|
|
||||
Thanks jggimi for the response,
I have decided not to use "phpmyadmin", there probably is no need for it. So any way, I decided to try "sqlite3", installed it, how ever I am having problems accessing it as well. This is the error I get: Code:
Connection failed: SQLSTATE[HY000] [14] unable to open database file make sense of, in any event still trying to find more info,... Code:
man sqlite3 it is mostly good for the commands, etc. I did start a data base, it is in : /home/garry/mybb.db I am guessing some where else, needs to be configured, but so far have no idea where. Thanks for taking the time to read and reply.
__________________
My best friends are parrots |
|
||||
I'd like to point out two things which may be helpful to you.
1. Your web server, httpd(8), is acting as a browser connector only. Your PHP application is connected via php-fpm, using FastCGI. 2. Just like httpd(), by default php-fpm uses /var/www as a chroot. See chroot(8) and chroot(2) for what this means. The end result is that your PHP database connection, if on the local system, must be stored inside this chroot directory structure. |
|
||||
Thanks,
Yes I have read this also in some other docs, but for some reason am still not grasping some thing, ...............
__________________
My best friends are parrots |
|
||||
Here's a "graphic" of the typical web application that uses PHP and FastCGI - there are three services:
Code:
[Web server] - [php-fpm] - [database engine]
What is a chroot? Simply, it is a restriction which assigns a directory as "/" to a process. In this case, php-fpm uses "/var/www" as its "/" directory, just as the web server httpd(8) does. If you create a SQLite database in /var/www/GarryR/databases/database.file.db php-fpm sees that file as /GarryR/databases/database.file.db. Due to the chroot, php-fpm cannot access anything in your filesystem outside of /var/www. (It's a little confusing because php-fpm uses /etc/php-fpm.conf, which is outside the chroot structure. It reads that file during its initialization phase, before it starts its chrooted child processes.) |
|
||||
Ok, thanks, now that is more clear, also I was beginning to think it needed to some thing
like that. Actually on mine at this time only seems to access what is in the "htdocs" dir,... Code:
$ cd /var/www/htdocs/ $ ls Xindex.php index.html mybb.db bgplg index.php phpMyAdmin images mybb How ever still could not access it. I can access "index.html", that is all ways easy. But for example, if index.html is not in "htdocs", like /var/www/index.html (for example ) does not work. The same, I was able to access index.php, as long as it is in "htdocs", how ever last night something else I changed, broke that again, no php can be accessed, I think it was some change I made in 'httpd.conf', but have not really started looking at everything yet today. Another "to clarify" for example, when the "mybb" and/or the "phpMyAdmin" were out side of the htdocs, but inside :/var/www/ , I could not access the "install.php" nor "setup.php", but when I placed them (the entire dir,with files and subdirs), when I placed the in 'htdocs' , I could access the php documents,etc. How ever, as shown previously, the "install.php", needs to access the data base, to do the installation,.. It does make sense to me, now that I need to have the data base in " /var/www/htdocs/ " I think,.... Quote:
Quote:
__________________
My best friends are parrots |
|
||||
Note your httpd.conf - and the file name for the php-fpm Unix domain socket file:
Code:
fastcgi socket "/run/php-fpm.sock" For additional clarity, I'll point you to these two parts of the httpd.conf(5) man page: Quote:
Quote:
|
|
||||
Ok, thanks,
How ever: Quote:
Code:
$ cd /var/www/run $ ls $ find/or create it, to put it there ? On the "chroot", so should I run a command like this: Code:
# chroot directory /var/www in the httpd.conf file ? IE: Code:
directory { root /var/www #or alternatively root /var/www/htdocs ???? index "index.php" } location "*.php" { fastcgi socket "/run/php-fpm.sock" } } 1 says: Quote:
Quote:
not sure how or where I would do that,... apparently it defaults to /htdocs thanks
__________________
My best friends are parrots Last edited by PapaParrot; 17th July 2017 at 07:22 PM. |
|
||||
My point was that your initially posted httpd.conf did not specify chroot or root values. Your chroot was "/var/www" and your document root was "/htdocs" under the chroot, or "/var/www/htdocs" -- which you have stated is where your server found its documents.
You don't need to add or change these, necessarily. I was trying to answer your question regarding your htdocs directory, and at the same time explain why your web server uses /var/www for all its files, and will use /var/www/htdocs as the default root document directory for any server you configure. --- edited to add --- If the file isn't in /var/www/run, then perhaps there's a /var/www/htdocs/run directory. I don't have access to an operational server at the moment, since I'm at $DAYJOB behind the Great Corporate Firewall (TM) without direct Internet access. But that socket file is how php-fpm connects with the web server. Last edited by jggimi; 17th July 2017 at 07:50 PM. Reason: added php socket connectivity comment |
|
||||
Ok, thanks...
also : Quote:
Code:
; Note: This value is mandatory. listen = /var/www/run/php-fpm.sock Code:
; Chroot to this directory at the start. This value must be defined as an ; absolute path. When this value is not set, chroot is not used. ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one ; of its subdirectories. If the pool prefix is not set, the global prefix ; will be used instead. ; Note: chrooting is a great security feature and should be used whenever ; possible. However, all PHP paths will be relative to the chroot ; (error_log, sessions.save_path, ...). ; Default Value: not set ;chroot = /var/www |
|
||||
The default as shipped in the OpenBSD package is chrooted:
Code:
; Default Value: not set chroot = /var/www
|
|
||||
So , in other words it should be like this:
Code:
; Default Value: not set chroot = /var/www I miss understood , when it says : Quote:
Code:
; Default Value: not set chroot = /var/www is not set, and I added the ( Confused , thinking I maybe I had changed it before,and did not remember. Quote:
Quote:
to have it "set" the way it is supposed to be,... ====================== I think at this point my best option is to delete everything I installed, all the php,and data base packages, etc. and start over. Thanks for taking the time on this, Quote:
"operational server",... When I started my linux server, a real server online, I first tried doing it on my home PC using "localhost" similar to what I am doing with OpenBsd now. I had similar problems, on the "home PC" and localhost,... Finally I decided to just go ahead and "rent" the server, I found a company that I could afford and started the server, all they did is install the linux version I requested, and sent me a message with my info for ssh / sftp access. They are NOT a "hosting service", and the rest was up to me, installing the php,database,etc. Setting up the website, domain names etc,... To shorten a long story, everything went much smoother then it had when I was trying on the "home PC" , localhost. I need to think about it some more, and still want to make one more try at this , just on my PC and localhost, howver I am thinking it will be easier on the real server, ... any way my babies are all crying, so I need to run,... thanks
__________________
My best friends are parrots |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenBSD As DNS Server | 3v1l | OpenBSD Packages and Ports | 8 | 6th February 2014 05:06 AM |
ssh server on OpenBSD | MarinosK | OpenBSD General | 4 | 16th February 2011 07:38 PM |
How to build a OpenBSD server? | fender0107401 | OpenBSD Installation and Upgrading | 6 | 15th October 2010 07:11 PM |
OpenBSD Xterminal Server | jjjustjjjay | OpenBSD General | 0 | 17th April 2010 12:46 PM |
Caching-only DNS server on OpenBSD | Oko | OpenBSD General | 1 | 13th September 2009 08:30 PM |