Categories
- FFMpeg (5)
- Libav (1)
- Google (3)
- iBeacon (1)
- LDAP (3)
- Me (2)
- Network (11)
- OS (149)
- RTMP (4)
- SIP (1)
- Kamailio (1)
- SNMP (1)
- VMware (20)
- VCP考試 (1)
- 伺服器 網站服務 (105)
- 名詞解釋 (4)
- 專案管理 (1)
- 工具軟體 (50)
- Adobe (1)
- FMS (1)
- Cloudera (1)
- Docker (1)
- Eclipse (4)
- Intellij (2)
- OBS (2)
- Office (10)
- Excel (4)
- PowerPoint (5)
- Postman (1)
- Splunk (13)
- Virtualbox (2)
- Visual Studio (2)
- 文字編輯器 (10)
- Sublime Text 2 (6)
- Sublime Text 3 (3)
- Vim (3)
- 連線工具 (1)
- Xshell (1)
- Adobe (1)
- 程式語言 (79)
- CSS (2)
- HTML (2)
- iOS (1)
- Java (30)
- JavaScript (5)
- jQuery (4)
- jsTree (2)
- JSP (3)
- PHP (16)
- Python (7)
- Ruby (1)
- sed (1)
- Shell Script (8)
- Windows Bash Script (1)
- XML (1)
- 資料庫 (37)
- FFMpeg (5)
Category Archives: Apache
[Apache] wordpress permalink 404 issue
edit site conf (vim /etc/apache2/sites-available/pr.site.org.conf)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<VirtualHost pr.site.org:80> ServerName pr.site.org ServerAdmin webmaster@localhost DocumentRoot /var/www/pr.site.org # !-- add this section <Directory /var/www/pr.site.org> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> # !-- ErrorLog ${APACHE_LOG_DIR}/pr_error.log CustomLog ${APACHE_LOG_DIR}/pr_access.log combined </VirtualHost> |
enable apache2 rewrite module
1 |
a2enmod rewrite |
restart apache2 service
1 |
service apache2 restart |
Ref. [1] Victor Hung’s Diary: 「教學」解決 WordPress 固定網址設定 404 錯誤 [2] DigitalOcean: WordPress permalinks tried everything
Posted in Apache, Ubuntu, WordPress
Leave a comment
[Apache] Redirect 80 to 8080
enable proxy_module, proxy_http_module, rewrite_module set < Directory path > in apache config RewriteEngine on AllowOverride All edit .htaccess in your folder < IfModule mod_rewrite.c > RewriteEngine On RewriteBase / RewriteRule ^(.+)$ http://localhost:8080/jwebadm/$1 [P,L] < /IfModule > restart apache
Posted in Apache
Leave a comment
[Apache] Proxypass
Because the default web port of Elasticsearch is 9200. And I want to change it with 80. Maybe I could use the proxypass function. enable the proxy, and restart apache
1 2 3 |
a2enmod proxy a2enmod proxy_http service apache2 restart |
add following into the /etc/apache2/sites-enabled/000-default.conf
1 2 3 4 5 6 7 8 9 10 11 |
<VirtualHost *:80> ProxyPreserveHost On ProxyVia full <proxy> Order deny,allow Allow from all </proxy> ProxyPass /kibana9200 http://localhost:9200 </VirtualHost> |
edit the kibana … Continue reading
Posted in Apache, Elasticsearch, Kibana
Leave a comment
Apache SSL Enable
環境 CentOS 5.x i386 產生 key
1 2 3 4 5 6 7 |
[root@Web test]# openssl genrsa -des3 -out site.key 2048 Generating RSA private key, 2048 bit long modulus ............+++ ..................+++ e is 65537 (0x10001) Enter pass phrase for site.key: Verifying - Enter pass phrase for site.key: |
產生 csr
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[root@Web test]# openssl req -new -key site.key -out site.csr Enter pass phrase for site.key: #輸入剛剛產生key時輸入的資訊 You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [GB]:TW State or Province Name (full name) [Berkshire]:Taiwan Locality Name (eg, city) [Newbury]:Taipei City Organization Name (eg, company) [My Company Ltd]:Cowman Organizational Unit Name (eg, section) []:IT Common Name (eg, your name or your server's hostname) []:Cowman.ip Email Address []:cowman.chiang@gmail.com Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: #可以直接按enter忽略 An optional company name []: #可以直接按enter忽略 |
cat csr,將資料丟到憑證申請的網站輸入
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
[root@Web test]# cat site.csr #將以下的資料複製,貼至申請的網站 -----BEGIN CERTIFICATE REQUEST----- MIIC1DCCAbwCAQAwgY4xCzAJBgNVBAYTAlRXMQ8wDQYDVQQIEwZUYWl3YW4xFDAS BgNVBAcTC1RhaXBlaSBDaXR5MQ8wDQYDVQQKEwZDb3dtYW4xCzAJBgNVBAsTAklU MRIwEAYDVQQDEwlDb3dtYW4uaXAxJjAkBgkqhkiG9w0BCQEWF2Nvd21hbi5jaGlh bmdAZ21haWwuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuUwx YtxHedYFykUgJuhtKGF0UuzPZ195QW9imVbFy0hT3Qt9YLKrmVESTFXxcdcLI6ty uSB3kZbnsOBr7XgGezso/lsY3dEprUplyYOXkKZsYXl7n4l7KU7nf7siGW0QY6xS oq1+7IIWa7Z9sKfdYUU9BsmH4c3YduuTa4WKdhOtn1RfSmqr5Gt+i35WZXc2/NUo efTHqsTmICh26eLjCmqrjgLfnSK9FpSa5q7nKbvK9s5q9Qae3vpECgJRf1klP1cS kBUTBoa6f46Wx+nWG/+QFpsW95w84RxxAIuUsTW2VcG6Ay6Q8TDEncj7iQ0TpJnh M3BCaepcnRVB7pNmYQIDAQABoAAwDQYJKoZIhvcNAQEFBQADggEBACmQWu30vr1v UuFxszR6ZUC3e25EEwCNg5UNh8iG9abauiE2K7l9lVWPicYdoZ1GjWGT13zMslwC 4c8nxvBKZfh4QGw5ALJvb1SZhvO/OMjPGCfQjuWRza44nNaaKi+BtCVHtglqvxTP EXpCODWd+E9x5NCzKyXLGXJpT3rDg4Ov1QaGNMtNByQLD+SgsoTR+yS+RcxwS11Y Ul26LrxnrbUvkwMV0/OWvbNREKSv3RsfjMWVsAtVwmdkRKlUNAFXMIOvAwmSImd/ +0ya5gEv4M+JVWWYy6vEnUOV333eR9tR4eCw7YO862TFdic9+4OPhVFpKeWJLANz wQ4uUOWkuPA= -----END CERTIFICATE REQUEST----- |
以namecheap的comodo憑證為例,選擇伺服器為 apache + mod_ssl,會回傳兩個檔案至mail中 cowman_ip.ca-bundle cowman_ip.crt 安裝mod_ssl
1 |
yum install mod_ssl |
取消需要輸入phase的機制
1 2 3 |
[root@Web test]# openssl rsa -in site.key -out site-nopass.key Enter pass phrase for roamingcenter_tanet_edu_tw.key: writing RSA key |
編輯 apache 設定檔,範例是在 /etc/httpd/conf.d/ssl.conf
1 2 3 4 5 6 7 |
[root@Web test]# vim /etc/httpd/conf.d/ssl.conf <VirtualHost _default_:443> SSLEngine on SSLCertificateFile /etc/httpd/certs/cowman_ip.crt SSLCertificateKeyFile /etc/httpd/certs/site-nopass.key SSLCertificateChainFile /etc/httpd/certs/cowman_ip.ca-bundle |
將 http 轉至 https,修改 /etc/httpd/conf/httpd.conf
1 2 3 4 5 6 |
[root@Web test]# vim /etc/httpd/conf/httpd.conf #加在最後面 RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} |
重新啟動 apache
1 |
service httpd restart |
!! 記得檢查iptables防火牆設定
Posted in Apache, CentOS, SSL
Leave a comment
htaccess ( apache 存取控制 )
修改 /etc/httpd/conf/httpd.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<Directory "/var/www/html"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # # AllowOverride None AllowOverride All //====修改為All # # Controls who can get stuff from this server. # Order allow,deny Allow from all |
到存取控制的目錄下新增檔案 .htaccess
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
vim ./htaccess <files 控管的檔案> order deny,allow deny from all </files> AuthName "Pop UP 視窗顯示的文字" AuthUserFile 密碼檔案存放地 AuthType Basic Require valid-user Order Deny,Allow Deny from all Allow from 允許直接存取的網段,不需要輸入密碼 Satisfy Any |
設定權限 htpasswd 第一次使用時參數為 “-c”
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
[root@localhost ~]# htpasswd Usage: htpasswd [-cmdpsD] passwordfile username htpasswd -b[cmdpsD] passwordfile username password htpasswd -n[mdps] username htpasswd -nb[mdps] username password -c Create a new file. -n Do not update file; display results on stdout. -m Force MD5 encryption of the password. -d Force CRYPT encryption of the password (default). -p Do not encrypt the password (plaintext). -s Force SHA encryption of the password. -b Use the password from the command line rather than prompting for it. -D Delete the specified user. [root@localhost ~]# htpasswd -c 密碼檔案存放路徑 使用者名稱 New password: Re-type new password: Adding password for user 使用者名稱 |
Posted in Apache
Leave a comment