Skip to content
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

docs: improve "Hosting with Apache" #7679

Merged
merged 11 commits into from
Jul 11, 2023

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jul 8, 2023

Description

  • improve document structure
  • fix the project folder location for the configuration

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [] Unit testing, with >80% coverage
  • User guide updated
  • [] Conforms to style guide

@kenjis kenjis added the documentation Pull requests for documentation only label Jul 8, 2023
@kenjis
Copy link
Member Author

kenjis commented Jul 8, 2023

The current doc says to set the document root to /opt/lamp/apache2/htdocs/myproject/public,
and /opt/lamp/apache2/htdocs is the document root of the main server.

This is not good.

<Directory "/opt/lamp/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
<VirtualHost *:80>
    DocumentRoot "/opt/lamp/apache2/htdocs/myproject/public"
    ServerName myproject.local
    ErrorLog "logs/myproject-error_log"
    CustomLog "logs/myproject-access_log" common
</VirtualHost>

https://codeigniter4.github.io/CodeIgniter4/installation/running.html#virtual-hosting

@kenjis
Copy link
Member Author

kenjis commented Jul 8, 2023

Changed the location of the project folder: 3bab114


LoadModule vhost_alias_module modules/mod_vhost_alias.so

Adding Host Alias
-----------------

Add a host alias in your "hosts" file, typically **/etc/hosts** on unix-type platforms,
or **c:/Windows/System32/drivers/etc/hosts** on Windows.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're here, these should be backslashes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Fixed.


<Directory "/opt/lamp/apache2/myproject/public">
AllowOverride All
Require all granted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I've used this directive before. Is it necessary? Secure? Advised?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was documented:

If your project folder is not a subfolder of the Apache document root, then your
<VirtualHost> element may need a nested <Directory> element to grant the web server access to the files.

/opt/lamp/apache2/htdocs/myproject/public is in the main document root /opt/lamp/apache2/htdocs.
It is not good. So I moved it.

Comment on lines +229 to +230
# Apache >= 2.4:
Require all granted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, it looks like this is a new approach. I trust you on this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? The change here is simply a change in indentation.

@kenjis kenjis force-pushed the docs-apache-config branch from 3bab114 to 45165e1 Compare July 11, 2023 21:41
@kenjis kenjis merged commit 6cedbe9 into codeigniter4:develop Jul 11, 2023
@kenjis kenjis deleted the docs-apache-config branch July 11, 2023 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Pull requests for documentation only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants