If you already trying to setup an OpenBSB Webserver using Apache + MySql + PHP, and now you want to replace the apache webserver with Nginx, you can follow the follong tutorial:
Step 1: Remove Apache Webserver
To remove apache webserver:
|
# pkg_delete apache-httpd-2.2.22 apache-httpd-2.2.22: ok Read shared items: ok --- -apache-httpd-2.2.22 ------------------- You should also run /usr/sbin/userdel _apache2 You should also run /usr/sbin/groupdel _apache2 |
|
# /usr/sbin/userdel _apache2 # /usr/sbin/groupdel _apache2 |
Step 2: Installing Nginx
|
# pkg_add nginx Ambiguous: choose package for nginx a 0: 1: nginx-1.0.15 2: nginx-1.0.15-passenger Your choice: 1 nginx-1.0.15: ok |
Step 3: Intstaling PHP-FPM
|
# pkg_add php-fpm php-fpm-5.3.14p0: ok The following new rcscripts were installed: /etc/rc.d/php_fpm See rc.d(8) for details. |
Step 4: Start ONMP services automatically
|
# nano /etc/rc.conf.local |
put the following lines:
|
mysqld_flags="" pkg_scripts="mysqld nginx php_fpm" |
Step 5: Setting Up Nginx
Edit /etc/nginx/nginx.conf and add “index.php” to the line that has the other index files. The config block should look like this, but you can alter the order if you wish.
|
location / { root /htdocs; index index.html index.htm <a href="http://www.info-vijesti.com/">index</a>.php; } |
Uncomment the following block of configuration to enable nginx to forward PHP requests to php-fpm.
|
location ~ .php$ { root /htdocs; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /htdocs$fastcgi_script_name; include fastcgi_params; } |
Step 6: Reboot OpenBSD
Once everything is installed and configured to start automatically, reboot to make sure everything starts up as expected.
Step 7: Testing
Create phpinfo file:
|
echo "" | sudo tee /var/www/htdocs/phpinfo.php |
Open phpinfo script:
|
http://your-OpenBSD-ip-address/phpinfo.php |
Recent Comments