Tampilkan postingan dengan label Apache. Tampilkan semua postingan
Tampilkan postingan dengan label Apache. Tampilkan semua postingan
Rabu, 06 Agustus 2014
Senin, 04 Agustus 2014
14.03
No comments
- Membuat URL bersih, ramah SEO dan mudah dibaca.
- Menyembunyikan fungsi yang mendasari PHP sehingga akan meningkatkan keamanan internal situs.
Rewrite URL paling sering digunakan untuk masking URL yang kompleks, untuk meningkatkan SEO (Search Engine Optimization) dan membuat URL lebih mudah dibaca. Contoh penggunaanya:
- http://localhost/coba/index.php?artikel=20
- http://localhost/coba/tutorial-php.html
contoh Url pertama merupakan link asli sebuah halaman sebelum di rewrite, sedang yang kedua yang sudah di rewrite. Url kedua lebih mudah dibaca dan meningkatkan SEO (Search Engine Optimization) karena mengandung kata kunci. Aturan penulisannya juga menyembunyikan index.php?artikel=20 yang memiliki manfaat tidak mengekspos PHP untuk klien. Jadi itu meningkatkan keamanan website.
Sintaks RewriteRule sebagai berikut
RewriteRule Pattern Substitution [flags]contoh implementasinya sebagai berikut:
RewriteEngine On
RewriteRule ^([0-9]{4})/([0-9]{0,2})/([^/]+)/$ /index.php?y=$1&m=$2&t=$3 [S]
RewriteRule ^error403\.php - [F]
Setiap baris disebut Instruksi. Baris pertama adalah putaran di Rewrite Mesin. Baris kedua adalah pencocokan URL patern menggunakan regex. Baris ketiga mendeteksi jika url posting naskah dan memastikan redirect ke 403 (Forbidden Response). [S] dan [F] adalah .htaccess flags.Kamis, 19 September 2013
13.56
No comments
jQuery is a multi-browser (cf. cross-browser) JavaScript library designed to simplify the client-side scripting of HTML. It was released in January 2006 at BarCamp NYC by John Resig. It is currently developed by a team of developers led by Dave Methvin. Used by over 65% of the 10,000 most visited websites, jQuery is the most popular JavaScript library in use today.
jQuery is free, open source software, licensed under the MIT License. jQuery's syntax is designed to make it easier to navigate a document, select DOM elements, create animations, handle events, and develop Ajax applications. jQuery also provides capabilities for developers to create plug-ins on top of the JavaScript library. This enables developers to create abstractions for low-level interaction and animation, advanced effects and high-level, theme-able widgets. The modular approach to the jQuery library allows the creation of powerful dynamic web pages and web applications.Read More
The collection below comprises fresh valuable jQuery image sliders that serve their purpose well, and are available absolutely free of charge.
Adaptor is an advanced image slider that leverages various amazing 3d effects for transitions. You can choose between stylish vertical or horizontal 3d scroll and standard 2d transitions.
BeaverSlider is a basic jQuery image slider that ably showcases portfolio pieces. It is very flexible and fully customizable, has a dynamic message box, and effectively co-works with custom CSS classes.
Sequence is an adaptive image slider that, in addition, has a full and requisite touch screen and cross browser support. It provides owner with various CSS3 transitions.
Slide is based on a modern, time-tested and powerful combination of CSS3 and Javascript. It is a simple cross-browser slider with stunning and smooth 3d effects.
Selasa, 28 Mei 2013
10.45
No comments
Dibawah ini merupakan contoh penggunaan fungsi preg_match untuk memvalidasi email apakah email anda valid atau tidak.
<?php
$pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD';
$emailaddress = 'test@gmail.com';
if (preg_match($pattern, $emailaddress) === 1) {
echo "valid";
}
?>
Selamat Mencoba.
Rabu, 15 Mei 2013
11.40
No comments
Berikut ini adalah contoh program untuk menjalankan atau untuk mengimport sql file dengan php.
<?php
$mysqli = new mysqli('host', 'username', 'password', 'database');
if (mysqli_connect_error()) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
echo 'Success... ' . $mysqli->host_info . "<br />";
echo 'Retrieving dumpfile' . "<br />";
$sql = file_get_contents('file .sql nya');
if (!$sql){
die ('Error opening file');
}
echo 'processing file <br />';
mysqli_multi_query($mysqli,$sql);
echo 'done.';
$mysqli->close();
?>
Terima kasih.
Selasa, 14 Mei 2013
09.24
No comments
- Make sure your PHP engine location path in system variable.
- Make sure you active php_pdo_mysql on php.ini
Uncomment the following to use a
MySQL database on protection/config/main.php
'db'=>array(
'connectionString' =>
'mysql:host=localhost;dbname=yiidb',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'your pass',
'charset' => 'utf8',
),
If your
error in console
Uncomment the following to use a MySQL
database protection/config/console.php
'db'=>array(
'connectionString'
=> 'mysql:host=localhost;dbname=yiidb',
'emulatePrepare'
=> true,
'username' =>
'root',
'password' =>
'your pass',
'charset' =>
'utf8',
),
Have Nice Day
Senin, 13 Mei 2013
10.05
No comments
Step 1: Assigning PHP engine location path in system variable
- Go to “My Computer” ->Right click and select "Properties"
- Click "Advanced system settings" from left pane
- Under "Advanced" tab click on "Environment Variables"
- Under "System variables" scroll down and find text "Path" then Double click on it
- Now enter your PHP engine location on end of the "variable value" field
- i.e. for wamp entered "C:\wamp\bin\php\php5" or for xampp "C:\xampp\php". Just enter location without double quotes
- Click ok and finally exit from this.
Step 2: Create new folder under your web root folder i.e "testyii"
Step 3: Download yii framework and extrack under web root folder
- Go "http://www.yiiframework.com/" and download latest Yii framework zipped file
- Unzip and rename folder to "yii"
- Using command-
- C:\web root>cd yii\framework\
- C:\web root \yii\framework>yiic webapp C:\web root\testyii
- Create a Web application under ‘C:\wamp\www\bid’? [Yes|No] y
- Your application has been created successfully under C:\web root\testyii.
Now you are ready to browse your project by accessing the URL : http://localhost/testyii/
Sabtu, 06 April 2013
09.28
No comments
Installasi Instant client di windows
1. Download oracle instant client di http://www.oracle.com/technetwork/topics/winsoft-085727.html
2. Simpan file zip instant client itu (instantclient-basic-win32-11.1.0.7.0.zip) di c:/oracle (buat direktori tersebut jika belum ada)
3. Unzip file instantclient-basic-win32-11.1.0.7.0.zip
4. Setup system %PATH% and %TNS_ADMIN% variables
· In Windows explorer LEFT pane, right click on “My Computer” icon and click “Properties”
· Click “Advanced” tab
· Click Environment variables button
· In the “System Variables” panel select “Path” variable and click “Edit” button
· In the “Variable Value” field paste the following BEFORE all other path values that point to your OLD Oracle clients (jangan lupa member):
C:\oracle\instantclient_11_2;
· click “Ok”
Edit variable TNS_ADMIN (bisa ada di user variable atau system variable) lalu tambahkan C:\oracle\instantclient_11_2; di variable value nya. Jika belum ada maka buat user variable baru dengan nama TNS_ADMIN, lalu isikna C:\oracle\instantclient_11_2; ke variable valuenya
· click “OK”
5. setup tnsnames.ora file
jika sudah memiliki file tnsnames.ora, anda bisa mengkopinya langsung ke C:\oracle\instantclien_11_2
6. set path yang lain dengan cara:
· buka cmd
· ketik set path=c:\oracle\instantclient_11_2; %PATH%
· ketik set TNS_ADMIN=c:\oracle\instantclient_11_2
· ketik set LD_LIBRARY_PATH=c:\oracle\instantclient_11_2
· ketik set SQLPATH=c:\oracle\instantclient_11_2
7. test instant clien yang sudah di configurasi dengan menggunakan sqlplus
ketik sqlplus di cmd, masukan nama database username@tnsname lalu maskkan passwordnya
Kamis, 04 April 2013
14.10
No comments
Konversi .htaccess dari Apache ke Nginx
Contoh:
Jika pada apache
RewriteEngine On
RewriteRule ^index.html$ ./index.php?mdrw=on
RewriteRule ^manual.html$ ./index.php?action=manual&mdrw=on
RewriteRule ^([0-9]+)_([-0-9]+).html$ ./index.php?action=vtopic&forum=$1&page=$2&mdrw=on
Maka pada Nginx
rewrite ^index.html$ index.php?mdrw=on last;
rewrite ^manual.html$ index.php?action=manual&mdrw=on last;
rewrite ^([0-9]+)_([0-9]+).html$ index.php?action=vthread&forum=$1&page=$2&mdrw=on last;
Semoga bermanfaat
14.07
No comments
Kadang kala blog atau web kita tidak bisa diakses, dan muncul beberapa pesan error. Seperti 403, 404, 500 error bad gateway dan lain-lain. Sebenarnya apa sih arti dari pesan-pesan error tersebut?akan saya jelaskan sedikit dibawah ini.
HTTP Error 404 – Not Found
Ada dua kemungkinan penyebab yang sering terjadi apabila muncul pesan seperti ini.
File yang diakses tidak ada, apabila Anda sebagai pemilik web tersebut, silahkan coba file yang Anda akses, apakah ada atau tidak pada folder public_htm. Namun jika file ada tetap muncul pesan error seperti diatas maka kita ke point 2.
URL rewritenya tidak benar, URL rewrite digunakan untuk membuat link-link pada website Anda menjadi lebihsimpel dan bagus. Dan perintah-perintah URL rewrite diletkan pada file .htaccess jadi silahkan periksa kembail perintahnya, apakah sesuai dengan link yang Anda akses.
HTTP Error 403 Forbidden
Muncul error seperti diatas paling sering terjadi disebabkan oleh permission pada folder/file yang dituju tidak membolehkan untuk dilihat oleh publik. Apabila Anda ingin mengijinkan publik untuk mengakses folder/file tersebut silahkan set permissionnya menjadi 755 atau 644.
HTTP Error 500 – Internal Server Error
Hal ini seperti diatas paling sering disebabkan kesalahan pada perintah-perintah di file .htaccess. Jadi coba cek kembali perintah-perintah yang Anda masukkan.Kalau masih tetap maka coba cek ulang apakah mod_rewrite sudah aktif atau belum.
HTTP Error 503 – Service Unavailable
Pesan kesalahan ini mengisyaratkan bahwa server web tempat situs anda berada saat ini tidak dapat menangani permintaan HTTP dari browser karena proses di server telah melebihi batas kapasitas yang ditentukan (atau sedang kelebihan beban).
HTTP Error – Bad Gateway
Pesan kesalahan ini terjadi ketika salah satu server yang terlibat dalam proses akses kesitus web yang sedang anda tuju mengalami masalah. Hal ini umumnya tidak disebabkan oleh program di sisi pengunjung, melainkan disisi aplikasi / script di server web, atau jaringan yang menuju ke server atau di sisi ISP. Meskipun penyebab masalahnya tidak terjadi di sisi Anda, kami menyarankan agar anda melakukan hal-hal berikut:
Mencoba untuk mengulangi akses ke situs web anda dengan merefresh, atau mengetik alamat langsung.
Jika error di atas terjadi pada saat anda mencoba script cgi/perl/php, silahkan periksa kembali sintaks-sintaks script tersebut. Menurut pengalaman kami, script-script cgi/perl/php yang memiliki kesalahan sintaks juga dapat menghasilkan pesan error seperti diatas pada saat di eksekusi.
Namun pesan semua kesalahan yang disebutkan diatas belum tentu penyebabnya merupakan yang dijabarkan tadi, untuk lebih jelasnya Anda dapat membuka error_log.
Nah itu lah arti dari pesan error yang kadang mengahmpiri blog kita. Semoga membantu.
Jumat, 15 Februari 2013
09.21
2 comments
Mudahnya Setting Koneksi PHP Oracle dengan WAMP server.
Setelah installasi oracle berhasil, Untuk setting koneksi PHP ke Oracle, kita install
dulu wampserver yang softwarenya dapat kita download secara gratis di website
resminya [DISINI]. Setelah selesai proses
installasinya kita jalankan wampservernya ->
klik icon wampserver -> arahkan ke php -> PHP extensions ->
aktifkan php_oci8.
Hasilnya dapat dilihat di phpinfo()
Kita coba dengan script php. Buat file
php baru yang isinya seperti dibawah ini.
<?php
$sid = "orcl";
$user = "scott";
$pass = "tiger";
$con = ocilogon($user,$pass,$sid);
if($con)
echo "Koneksi PHP ORACLE
Berhasil";
else
echo "Koneksi PHP ORACLE
Gagal";
?>
Simpan dengan nama cobaKoneksi.php dan
letakkan di folder c:\wamp\www.
Jalankan dengan browser, ketikan http://localhost/cobaKoneksi.php
jika berhasil maka akan muncul “Koneksi PHP ORACLE Berhasil” dan jika gagal akan
muncul “Koneksi PHP ORACLE Gagal”. Jika ada masalah silahkan membuat komen di
bawah ini.
08.50
No comments
EXPORTING MODULE
From version 2.3.5 an exporting module is available for Highcharts, which allows users to download images or PDF's of your charts. This module consists of an extra JavaScript file, exporting.js, and a web service or server module written in PHP. Highslide Software offers the exporting web service free of charge. If you include the exporting module in your charts, two buttons will appear in the upper right. One button prints the chart, which is done on the client side only. The other button handles exporting. By default, an SVG representation of the chart is sent by POST to http://export.highcharts.com, where it is converted using Apache's Batik converter to PDF, PNG or JPEG.
See the navigation and exporting reference items for a full documentation for the options available. Also see under "Methods and Properties" in the reference for members releated to exporting.
6.1 Client side setup
Add the exporting module JavaScript file after your highcharts.js file.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script src="/js/highcharts.js" type="text/javascript"></script> <script src="/js/modules/exporting.js" type="text/javascript"></script>
6.2 Server module setup
If you want to set up this web service on your own server, the
index.php file that handles the POST is supplied in the download package inside the/exporting-server directory.- Make sure that PHP and Java is installed on your server.
- Upload the
index.phpfile from the /exporting-server directory in the download package to your server. - In your FTP program, create directory called
tempin the same directory asindex.phpand chmod this new directory to 777 (Linux/Unix servers only). - Download Batik from http://xmlgraphics.apache.org/batik/#download. Find the binary distribution for your version of jre
- Upload
batik-rasterizer.jarand the entirelibdirectory to a location on your web server. - In the options in the top of the index.php file, set the path to batik-rasterier.jar.
- In your chart options, set the exporting.url option to match your PHP file location.
As an ASP.NET alternative to our Java/PHP based server module, Clément Agarini has kindly shared his export module for ASP.NET.
Source : http://docs.highcharts.com/
Selasa, 18 Desember 2012
10.38
No comments
Contoh penggunaan Memcache untuk menyimpan data.
<?php
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");
$key = "Test"; // Nama unique key yang akan disimpan (cache) di cluster memory
$cache_result = array();
$cache_result = $memcache->get($key); // nama object Memcached
if($cache_result){
// Jika request kedua (sudah di cache di awal)
$result=$cache_result;
}else{
// Jika request pertama ambil data dari database lalu distribusikan di memory server
$con = ocilogon("scott","tiger","orcl");
$sql ="SELECT * FROM EMP";
$sql = ociparse($con,$sql);
ociexecute($sql);
while(ocifetch($sql))
$result[]=ociresult($sql,"EMPNO"); // penyimpanan hasil query didalam array
$memcache->set($key, $result, MEMCACHE_COMPRESSED, 600); // disimpan 600 detik atau 10 menit dengan nama key $key
}
//Menampilkan data
foreach($result as $r){
echo "$r<br/>";
}
?>
Hasil dari file diatas, maka empno akan disimpan selama 10 menit.
09.52
1 comment
Needed
Files
·
memcached.exe Direct Link
·
MSVCP71.DLL Windows DLL Files
·
msvcr71.dll
·
php_memcache.dll Working memcache for PHP 5.3.4
Steps
1.
Copy MSVCP71.DLL, msvcr71.dll to
C:\windows\system32
2.
Copy memcached.exe into C:\memcached
3.
Run Command Prompt as Administrator
4.
type: C:\memcached\memcached.exe -d
install
5.
type: C:\memcached\memcached.exe -d
start
6.
Copy php_memcache.dll to
C:\wamp\bin\php\php5.3.4\ext
7.
Restart Apache using Wamp controls
8.
Enable WAMP -> PHP -> PHP
Extensios -> php_memcache
9. Run
this code to test the installation:
<?php
$memcache = new Memcache;
$memcache->connect("localhost",11211); # You might need to
set "localhost" to "127.0.0.1"
echo "Server's version: " .
$memcache->getVersion() . "<br />\n";
$tmp_object = new stdClass;
$tmp_object->str_attr =
"test";
$tmp_object->int_attr = 123;
$memcache->set("key",$tmp_object,false,3600);
echo "Store data in the cache (data
will expire in 3600 seconds)<br />\n";
echo "Data from the cache:<br
/>\n";
var_dump($memcache->get("key"));
?>
If you see anything but errors, you are now
using memcache!
Memcached,
by default, loads with 64mb of memory for it’s use which is low for most applications. To change this to something else, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached
Server in your
registry, find the ImagePath entry and change it to look something
like this:
“C:\memcached\memcached.exe”
-d runservice -m 512
Now when you start the
service via net start “memcached Server”, it will run with 512mb of memory at
it’s disposal.
Selasa, 17 April 2012
08.48
No comments
Here are my notes how I managed to get HTTPS working on Wamp5 in my test environment, meaning my laptop. The credits go to the guys at [www.apache-ssl.org].
OPENSSL_CONF ENVIRONMENT VARIABLE
Go to Control Panel – System – Advanced – Environment Variables
Add a new system variable OPENSSL_CONF:
Variable name: OPENSSL_CONF
Variable value: c:\wamp\Apache2\conf\openssl.cnf
Log out and log back in.
Go to the command prompt and type in:
set | more
Make sure you see the following line among the environment variables:
OPENSSL_CONF=c:\wamp\Apache2\conf\openssl.cnf
GENERATE KEY
Again in the command prompt, go to C:\wamp\Apache2\bin and run the following command:
openssl req -new > webserver.csr
The command runs and prompts you to enter a PEM pass phrase and verify it. Write down the phrase because you will need it later.
It will then ask you to enter information that will be incorporated into your certificate request. When the command finishes, it has created several files, including privkey.pem, in c:\wamp\apache2\bin.
REMOVE PASSPHRASE
Run the following command:
openssl rsa -in privkey.pem -out webserver.key
You will be prompted for the pass phrase from the previous step. The RSA key is written and the file webserver.key is now available in the folder.
CONVERT INTO SIGNED CERTIFICATE
Run the following command to create a certificate which expires after one year:
openssl x509 -in webserver.csr -out webserver.cert -req -signkey webserver.key -days 365
STORE CERTIFICATE FILES
Create a folder c:\wamp\OpenSSL with the following subfolders:
certs
crl
newcerts
private
Copy the following files to certs:
webserver.cert
webserver.csr
webserver.key
Copy the following files to private:
.rnd
privkey.pem
cacert.pem (same as above, just a wild guess)
MODIFY HTTPD-SSL.CONF
Change the following lines, adjusting the email address and the paths to your settings:
SSLSessionCache "shmcb:C:/wamp/Apache2/logs/ssl_scache(512000)"
SSLMutex default
# General setup for the virtual host
DocumentRoot "C:/www/mysecuresite"
ServerName localhost:443
ServerAdmin myemail@example.com
ErrorLog "C:/wamp/logs/mysecuresite_error_log"
TransferLog "C:/wamp/logs/mysecuresite_access_log"
SSLCertificateFile "C:/wamp/OpenSSL/certs/webserver.cert"
SSLCertificateKeyFile "C:/wamp/OpenSSL/certs/webserver.key"
SSLCARevocationPath "C:/wamp/OpenSSL/crl"
<Directory "C:/wamp/Apache2/cgi-bin">
CustomLog "C:/wamp/logs/ssl_request_log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
MODIFY OPENSSL.CNF
There is a file openssl.cnf in c:\wamp\Apache2\conf even though no extension is shown in Windows Explorer. Go to the DOS command prompt and run DIR to see the file extension. Make a backup copy of this file first and rename it in DOS to openssl.cnf.txt so that you can edit it.
Modify the base directory:
dir = c:/wamp/OpenSSL # Where everything is kept
Go to the DOS prompt and change the name of the file back to openssl.cnf.
MODIFY HTTPD.CONF
Last, but not least, make sure your secure site is part of the virtual hosts in Apache:
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
Include conf/extra/httpd-ssl.conf
TEST HTTPS
Run httpd –t and make sure the syntax is OK.
Restart Apache.
Check that port 443 is open by running the following in the command prompt:
netstat -an | more
Test the https connection from your browser and hopefully it works :-)
CLIENT CERTIFICATES
For details on how to generate a client certificate see the instructions at [www.apache-ssl.org]
OPENSSL_CONF ENVIRONMENT VARIABLE
Go to Control Panel – System – Advanced – Environment Variables
Add a new system variable OPENSSL_CONF:
Variable name: OPENSSL_CONF
Variable value: c:\wamp\Apache2\conf\openssl.cnf
Log out and log back in.
Go to the command prompt and type in:
set | more
Make sure you see the following line among the environment variables:
OPENSSL_CONF=c:\wamp\Apache2\conf\openssl.cnf
GENERATE KEY
Again in the command prompt, go to C:\wamp\Apache2\bin and run the following command:
openssl req -new > webserver.csr
The command runs and prompts you to enter a PEM pass phrase and verify it. Write down the phrase because you will need it later.
It will then ask you to enter information that will be incorporated into your certificate request. When the command finishes, it has created several files, including privkey.pem, in c:\wamp\apache2\bin.
REMOVE PASSPHRASE
Run the following command:
openssl rsa -in privkey.pem -out webserver.key
You will be prompted for the pass phrase from the previous step. The RSA key is written and the file webserver.key is now available in the folder.
CONVERT INTO SIGNED CERTIFICATE
Run the following command to create a certificate which expires after one year:
openssl x509 -in webserver.csr -out webserver.cert -req -signkey webserver.key -days 365
STORE CERTIFICATE FILES
Create a folder c:\wamp\OpenSSL with the following subfolders:
certs
crl
newcerts
private
Copy the following files to certs:
webserver.cert
webserver.csr
webserver.key
Copy the following files to private:
.rnd
privkey.pem
cacert.pem (same as above, just a wild guess)
MODIFY HTTPD-SSL.CONF
Change the following lines, adjusting the email address and the paths to your settings:
SSLSessionCache "shmcb:C:/wamp/Apache2/logs/ssl_scache(512000)"
SSLMutex default
# General setup for the virtual host
DocumentRoot "C:/www/mysecuresite"
ServerName localhost:443
ServerAdmin myemail@example.com
ErrorLog "C:/wamp/logs/mysecuresite_error_log"
TransferLog "C:/wamp/logs/mysecuresite_access_log"
SSLCertificateFile "C:/wamp/OpenSSL/certs/webserver.cert"
SSLCertificateKeyFile "C:/wamp/OpenSSL/certs/webserver.key"
SSLCARevocationPath "C:/wamp/OpenSSL/crl"
<Directory "C:/wamp/Apache2/cgi-bin">
CustomLog "C:/wamp/logs/ssl_request_log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
MODIFY OPENSSL.CNF
There is a file openssl.cnf in c:\wamp\Apache2\conf even though no extension is shown in Windows Explorer. Go to the DOS command prompt and run DIR to see the file extension. Make a backup copy of this file first and rename it in DOS to openssl.cnf.txt so that you can edit it.
Modify the base directory:
dir = c:/wamp/OpenSSL # Where everything is kept
Go to the DOS prompt and change the name of the file back to openssl.cnf.
MODIFY HTTPD.CONF
Change
#LoadModule ssl_module modules/mod_ssl.so
to
LoadModule ssl_module modules/mod_ssl.so
# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
Include conf/extra/httpd-ssl.conf
TEST HTTPS
Run httpd –t and make sure the syntax is OK.
Restart Apache.
Check that port 443 is open by running the following in the command prompt:
netstat -an | more
Test the https connection from your browser and hopefully it works :-)
CLIENT CERTIFICATES
For details on how to generate a client certificate see the instructions at [www.apache-ssl.org]
Langganan:
Postingan (Atom)






