Hiển thị các bài đăng có nhãn Apache. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn Apache. Hiển thị tất cả bài đăng

How to Install Apache on CentOS 7

 Install Apache on CentOS 7 | Liquid Web


  1. Install Apache:
    1. First, clean-up yum:
      sudo yum clean all
    2. As a matter of best practice we’ll update our packages:
      sudo yum -y update
    3. Installing Apache is as simple as running just one command:
      sudo yum -y install httpd
  2. Allow Apache Through the Firewall
    1. Allow the default HTTP and HTTPS port, ports 80 and 443, through firewalld:
      sudo firewall-cmd --permanent --add-port=80/tcpsudo firewall-cmd --permanent --add-port=443/tcp
    2. And reload the firewall:
      sudo firewall-cmd --reload
  1. Configure Apache to Start on Boot
    1. And then start Apache:
      sudo systemctl start httpd
    2. Be sure that Apache starts at boot:
      sudo systemctl enable httpd
  2. Other useful commands for Apache
    1. To check the status of Apache:
      sudo systemctl status httpd
    2. To stop Apache:
      sudo systemctl stop httpd

Permission denied AH01275: Can't open directory for index:

 [username@localhost ~]$ chcon -R --reference=/var/www/html /home/username/folder1/folder2/

[username@localhost ~]$ sudo chcon -R --reference=/var/www/html /home/username/folder/folder2/

[username@localhost ~]$ sudo systemctl restart httpd


Difference between and Apache directives

 Difference between <Location> and <Directory> Apache directives - Server Fault

Directory directive works only for filesystem objects (e.g. /var/www/mypage, C:\www\mypage), while Location directive works only for URLs (the part after your site domain name, e.g. www.mypage.com/mylocation).


The usage is straightforward - you would use Location if you need to fine tune access rights by an URL, and you would use Directory if you need to control access rights to a directory (and its subdirectories) in the filesystem.

How can I configure apache so that it prevents proxy servers to cache a specific URL on my website?

 How can I configure apache so that it prevents proxy servers to cache a specific URL on my website? - Server Fault


This is pretty easy to do with apache, for example to specific that nothing coming from your server should ever be cached, try this

<Location / >
   ExpiresActive On
   ExpiresDefault "now"
</Location>

You probably don't want to do this exactly, so look at the documentation for mod_expires and customise this for your needs.

Also, remember that in this scenario a browser and a proxy are treated the same. By sending expires headers with your responses that disable caching, you will be adding significant load and cost to running your site, not to mention slowing access your visitors.

Apache Redirect

https://serverfault.com/questions/344614/simple-apache2-redirect-from-one-domain-to-another

https://www.digitalocean.com/community/questions/how-to-redirect-https-ip-to-https-domain

https://stackoverflow.com/questions/33874212/htaccess-redirect-https-to-another-https

You cannot match scheme http:// in RewriteCond %{HTTP_HOST}.
You can use this rule:
RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteRule ^ https://www.domain.com%{REQUEST_URI} [R=302,L]
You can use the RedirectPermanent directive to redirect the client to your new URL.
Just create a very simple VirtualHost for the old domain in which you redirect it to the new domain:
<VirtualHost *:80>
    ServerName xy.example.com
    RedirectPermanent / http://abc.example.com/
    # optionally add an AccessLog directive for
    # logging the requests and do some statistics
</VirtualHost>

Renewing Facebook Graph API token automatically?

  Mã truy cập dài hạn https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived/ https://community.n8n.io/t/re...