基于redhat7.x的apache配置

server
yum -y install httpd mod_ssl mod_wsgi -y
systemctl enable httpd
防火墙打开http,https
cd /srv/www/
mkdir www.server.example.com
mkdir www0.example.com
mkdir server.example.com
ls -lZ
restorecon -r /srv/www
ls -lZ
cd /etc/httpd/conf.d
cat /usr/share/doc/httpd*/httpd-vhosts.conf
cat /usr/share/doc/httpd*/httpd-default.conf

vi server.example.com.conf
DocumentRoot /srv/www/server.example.com
ServerName server.example.com
ErrorLog "/var/log/httpd/www.server.example.com-ssl-error_log"
CustomLog "/var/log/httpd/www.server.example.com-ssl-access_log" common
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/localhost.crt(crt)vi ssl.conf
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key(key)vi ssl.conf
SSLCertificateChainFile /etc/pki/tls/certs/server-chain.crt(pem)vi ssl.conf
Require all granted

vi ssl.conf
SSLEngine on
cd /etc/pki/tls/certs/ wget* -0 server.crt
chmod 600 server.crt
cd /etc/pki/tls/private/ wget* -0 server.key
chmod 600 server.key
cd /etc/pki/tls/certs/ wget* -0 server.pem
chmod 600 server.pem
cd /srv/www/server.example.com
wget http://*** -0 index.html
ls -lZ
cd /etc/httpd/conf.d
vi www.example.com.conf
DocumentRoot /var/www/html/virtual
ServerName www.example.com
ErrorLog "/var/log/httpd/www.example.com-error_log"
CustomLog "/var/log/httpd/www.example.com-access_log" common

Require all granted
Require ip 172.25.0.10
mkdir -p /var/www/html/virtual
mkdir -p /var/www/html/virtual/restricted
ls -lZd /var/www/html/virtual
cd /var/www/html/virtual
wget http://*** -0 index.html
cd /etc/httpd/conf.d
vi www.server.example.com.conf
listen 8119
WSGIScriptAlias / /srv/www/www.server.example.com/webapp.wsgi
ServerName www.server.example.com
ErrorLog "/var/log/httpd/www.server.example.com-error_log"
CustomLog "/var/log/httpd/www.server.example.com-access_log" common

Require all granted
防火墙添加8119端口
cd /srv/www/ www.server.example.com
wget http://***/webapp.wsgi
ls -lZ
systemctl restart httpd

你可能感兴趣的:(基于redhat7.x的apache配置)