How to Install nginx and PHP on CentOS7

Install nginx and PHP on CentOS7

These are some notes from installing nginx on CentOS7

Install some prerequisites sudo yum -y groupinstall “Development tools” sudo yum -y install mlocate sudo yum -y install iptables-services sudo yum -y install php-mysql php-dom sudo yum -y install wget sudo service php-fpm restart Install GeoIP cd /tmp wget . . . → Read More: How to Install nginx and PHP on CentOS7

Testing SSL Chaining Issues

Recently I needed to debug an issue by testing SSL chaining issues My old standby tools (curl and openssl were not reporting any errors) The exception PKIX path validation failed: Path does not chain with any of the trust anchors Cause The cert from the keystore does not match the cert from . . . → Read More: Testing SSL Chaining Issues

nginx code igniter remove index.php prefix


Remove the index.php prefix from your nginx code igniter instance.

Assumptions In your main nginx conf file you define how php is called (unix socket or ip:port) You will replace with whatever your domain name is The proper logging path will be defined per your system as opposed to the location i have . . . → Read More: nginx code igniter remove index.php prefix

nginx redirect single url


Using nginx redirect single url



REDIRECT TO: nginx basic php location block example location / { try_files $uri $uri/ @mylocation; } location @mylocation { rewrite ^/foo(.*)$ /bar/ redirect; rewrite ^.*$ /index.php last; } nginx wordpress example location / { try_files $uri $uri/ @wordpress; } location @wordpress { rewrite ^/foo(.*)$ . . . → Read More: nginx redirect single url

linux remove blank lines from file

To remove blank lines from a file on a unix or linux computer try this:

# grep -v “^$” filename > newfilename

nginx logrotate script

nginx logrotate script

Create a new file at /etc/logrotate.d/nginx with contents: /var/log/nginx/*.log { daily missingok rotate 52 compress delaycompress notifempty create 640 root adm sharedscripts postrotate [ ! -f /var/run/ ] || kill -USR1 `cat /var/run/` endscript } Run Logrotate # /etc/cron.daily/logrotate

nginx ssl pfx

This article will explain what to do with nginx ssl pfx.

First get the pfx file to your server. In this example we will be using a directory called “ssl” off of the nginx root (where nginx.conf is located).

From within the ssl folder, export the certificate:

openssl pkcs12 -in -nokeys -out

Export . . . → Read More: nginx ssl pfx

Install PHP APC with Nginx on Centos 6.2

Install PHP APC with Nginx on Centos 6.2

Install latest apc:

# pecl install apc-3.1.10

Move your old apc.ini to a safe location:

# mv /etc/php.d/apc.ini /etc/php.d/apc.ini.old

Create a new /etc/php.d/apc.ini (content below):

; Enable apc extension module extension = ; Options for the APC module version >= 3.1.3 ; See…nfiguration.php ; This . . . → Read More: Install PHP APC with Nginx on Centos 6.2

nginx secure /user drupal

If you are not serving drupal out of a subdirectory use this config example:

location / { # This is cool because no php is touched for static content try_files $uri @rewrite; } location @rewrite { Some modules enforce no slash (/) at the end of the URL Else this rewrite block wouldn’t be needed . . . → Read More: nginx secure /user drupal

nginx php centos6 howto

Remove previous php installation

# yum remove php-cli php-common

Add the EPEL and REMI repos:

wget wget sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

Install nginx prerequisites

# yum install perl pcre-devel gperftools-devel geoip geoip-devel

Download nginx

# wget “”

Nginx configuration & installation:

# ./configure –prefix=/etc/nginx/ –sbin-path=/usr/sbin/nginx –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –pid-path=/var/run/ –lock-path=/var/run/nginx.lock –http-client-body-temp-path=/var/cache/nginx/client_temp –http-proxy-temp-path=/var/cache/nginx/proxy_temp . . . → Read More: nginx php centos6 howto