Setup Nextcloud 19.0.4 on Fedora 32
-
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
ok fixed. thanks.
sed '$d'for the win there.Nice! I was about to post that command.
-
@black3dynamite since you are better with
sedthan I am... Or at least better with Google and the man pages than I am..How can I fix this to use the environment variables instead of manual.
This is part of the next step to use the "pretty URL" as it is called.
It works fine like this.sudo sed -i -e 's/\(^DocumentRoot\s*\).*$/\1"\/var\/www\/html\/nextcloud"/' /etc/httpd/conf/httpd.confBut I want it to use the above
$WWW_PATHand$APP_FOLDERvariables. -
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
@black3dynamite since you are better with
sedthan I am... Or at least better with Google and the man pages than I am..How can I fix this to use the environment variables instead of manual.
This is part of the next step to use the "pretty URL" as it is called.
It works fine like this.sudo sed -i -e 's/\(^DocumentRoot\s*\).*$/\1"\/var\/www\/html\/nextcloud"/' /etc/httpd/conf/httpd.confBut I want it to use the above
$WWW_PATHand$APP_FOLDERvariables.What does the line do exactly?
Sets theDocumentRootparameter to/var/www/html/nextcloud?What does$WWW_PATHand$APP_FOLDERcontain?
Ah, the first post says:/var/www/htmlandnextcloud -
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
What does the line do exactly?
Sets theDocumentRootparameter to/var/www/html/nextcloud?Correct.
( # Start a capture group ^ # Matches the start of the line DocumentRoot # Matches the word I am want \s # a space character I should probably remove that. came from an example I found * # umm everything maybe? not sure inside the capture group also likely need removed ) # End capture group .* # Matches anything $ # Matches the end of the lineSo,
sedshould find any instance ofDocumentRootat the beging of a line. This happens only once in a default Apache config file.The capture group means to capture the term within the parentheses in a variable. This is the
1in the replacement section of thes///command.I am then appending "/var/www/html/nextcloud" to the captured string "DocumentRoot" to end up with his

-
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
What does$WWW_PATHand$APP_FOLDERcontain?
Ah, the first post says:/var/www/htmlandnextcloudAnd that is why I want to use the environment variables. Not everyone installs everything to the default location.
-
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
sudo sed -i -e 's/(^DocumentRoot\s*).*$/\1"/var/www/html/nextcloud"/' /etc/httpd/conf/httpd.conf
Better
sed. I removed the\s*
-
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
sudo sed -i -e 's/(^DocumentRoot\s*).*$/\1"/var/www/html/nextcloud"/' /etc/httpd/conf/httpd.conf
Better
sed. I removed the\s*
I think you can simplify it way more.
- you don't need
-e - don't use the
/separator, use for instance#. Sos#expression#replacement#. Then you don't have to escape your paths. And then you can put your variables straight in.
- you don't need
-
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
sudo sed -i -e 's/(^DocumentRoot\s*).*$/\1"/var/www/html/nextcloud"/' /etc/httpd/conf/httpd.conf
Better
sed. I removed the\s*
I think you can simplify it way more.
- you don't need
-e - don't use the
/separator, use for instance#. Sos#expression#replacement#. Then you don't have to escape your paths. And then you can put your variables straight in.
Don't think you need the sed script inside a quoted string either.
Maybe something like this:
sudo sed -i s#\(^DocumentRoot\).*$#\1$WWW_PATH/$APP_FOLDER# /etc/httpd/conf/httpd.confIf you want quotes around the sed "instructions" use
"so you get variable expansion, and not'.
But you don't need to quote a string as long as it doesn't contain spaces. - you don't need
-
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
you don't need -e
You just trying to fix all my old habits?
-
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
sudo sed -i -e 's/(^DocumentRoot\s*).*$/\1"/var/www/html/nextcloud"/' /etc/httpd/conf/httpd.conf
Better
sed. I removed the\s*
I think you can simplify it way more.
- you don't need
-e - don't use the
/separator, use for instance#. Sos#expression#replacement#. Then you don't have to escape your paths. And then you can put your variables straight in.
Don't think you need the sed script inside a quoted string either.
Maybe something like this:
sudo sed -i s#\(^DocumentRoot\).*$#\1$WWW_PATH/$APP_FOLDER# /etc/httpd/conf/httpd.confIf you want quotes around the sed "instructions" use
"so you get variable expansion, and not'.
But you don't need to quote a string as long as it doesn't contain spaces.I'll try it in a bit on my local test instance.
I'm in the middle of migrating the CentOS 7 system to the Fedora 32 system that caused me to write this in the first place.
- you don't need
-
Could not make it execute without the quotes
But this works.sudo sed -i 's#\(^DocumentRoot\).*$#\1 "'"$WWW_PATH"'/'"$APP_FOLDER"'"#' /etc/httpd/conf/httpd.conf -
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
sudo sed -i -e 's/(^DocumentRoot\s*).*$/\1"/var/www/html/nextcloud"/' /etc/httpd/conf/httpd.conf
Better
sed. I removed the\s*
I think you can simplify it way more.
- you don't need
-e - don't use the
/separator, use for instance#. Sos#expression#replacement#. Then you don't have to escape your paths. And then you can put your variables straight in.
Don't think you need the sed script inside a quoted string either.
Maybe something like this:
sudo sed -i s#\(^DocumentRoot\).*$#\1$WWW_PATH/$APP_FOLDER# /etc/httpd/conf/httpd.confIf you want quotes around the sed "instructions" use
"so you get variable expansion, and not'.
But you don't need to quote a string as long as it doesn't contain spaces.I'll try it in a bit on my local test instance.
I'm in the middle of migrating the CentOS 7 system to the Fedora 32 system that caused me to write this in the first place.
Hmm, maybe you need some quotes anyway,
The sed thing is really
s#regexp#\1 /www/whatever#(using `# as delimiter).
Where \1 tell sed to use the capture result of the first group which is "DocumentRoot".
Then a space and then the new path. - you don't need
-
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
Could not make it execute without the quotes
But this works.sudo sed -i 's#\(^DocumentRoot\).*$#\1 "'"$WWW_PATH"'/'"$APP_FOLDER"'"#' /etc/httpd/conf/httpd.confOK try this then:
sudo sed -i 's#\(^DocumentRoot\).*$#\1 '$WWW_PATH/$APP_FOLDER# /etc/httpd/conf/httpd.conf -
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
Could not make it execute without the quotes
But this works.sudo sed -i 's#\(^DocumentRoot\).*$#\1 "'"$WWW_PATH"'/'"$APP_FOLDER"'"#' /etc/httpd/conf/httpd.confOK try this then:
sudo sed -i 's#\(^DocumentRoot\).*$#\1 '$WWW_PATH/$APP_FOLDER# /etc/httpd/conf/httpd.confThat is missing the
"that need to be around the value. But did make me realize I did not need to do all the quoting around the/since I changed the delimeter.. habitssudo sed -i 's#\(^DocumentRoot\).*$#\1 "'$WWW_PATH/$APP_FOLDER'"#' /etc/httpd/conf/httpd.conf
-
\"#also works to end it.
-
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
Could not make it execute without the quotes
But this works.sudo sed -i 's#\(^DocumentRoot\).*$#\1 "'"$WWW_PATH"'/'"$APP_FOLDER"'"#' /etc/httpd/conf/httpd.confOK try this then:
sudo sed -i 's#\(^DocumentRoot\).*$#\1 '$WWW_PATH/$APP_FOLDER# /etc/httpd/conf/httpd.confThat is missing the
"that need to be around the value. But did make me realize I did not need to do all the quoting around the/since I changed the delimeter.. habitssudo sed -i 's#\(^DocumentRoot\).*$#\1 "'$WWW_PATH/$APP_FOLDER'"#' /etc/httpd/conf/httpd.conf
Starting to look pretty good I think.
I wonder about the
^DocumentRootthough. Apache don't need it to be the start of the line. There could be some whitespace first. -
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
I wonder about the ^DocumentRoot though. Apache don't need it to be the start of the line. There could be some whitespace first.
That is because there are 3 instances in the file. But only that one matters.

-
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
I wonder about the ^DocumentRoot though. Apache don't need it to be the start of the line. There could be some whitespace first.
That is because there are 3 instances in the file. But only that one matters.

I understand I'm just thinking about whitespace. It's very common to have indentation in the conf files. Especially when you are putting it under
virtualhost.Then the regex wont match but works fine in apache.
-
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
I wonder about the ^DocumentRoot though. Apache don't need it to be the start of the line. There could be some whitespace first.
That is because there are 3 instances in the file. But only that one matters.

I understand I'm just thinking about whitespace. It's very common to have indentation in the conf files. Especially when you are putting it under
virtualhost.This is not in a vhost. this is the main apache config file. Assumption is a single purpose server. anything else is advanced beyond this guide.
-
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
@JaredBusch said in Setup Nextcloud 19.0.4 on Fedora 32:
@Pete-S said in Setup Nextcloud 19.0.4 on Fedora 32:
I wonder about the ^DocumentRoot though. Apache don't need it to be the start of the line. There could be some whitespace first.
That is because there are 3 instances in the file. But only that one matters.

I understand I'm just thinking about whitespace. It's very common to have indentation in the conf files. Especially when you are putting it under
virtualhost.This is not in a vhost. this is the main apache config file. Assumption is a single purpose server. anything else is advanced beyond this guide.
Yeah, makes sense.