1. First install nginx apache PHP php-apache php-fpm php-cgi php-gd php-mcrypt php-pgsql php-sqlite packages.
2. Edit the Apache configuration file/etc/httpd/conf/httpd.conf, loadmodule mpm_event_module modules/mod_mpm_ event.so Line replaced with loadmodule Mpm_prefork_module modules/mod_mpm_prefork.so, Otherwise Apache startup will report the following error: apache is running a threaded MPM, but your the PHP Module is isn't compiled to be threa Dsafe. you need to recompile php. then join on any line after LoadModule Dir_module modules/mod_dir.so loadmodule Php5_module modules/libphp5.so, if necessary is used php-fpm do not do this step; Finally, add the include conf/extra/php5_module.conf to the last side of the include. 3. Edit/etc/php/php.ini, first set up date.timezone=asia/chongqing, then set open_basedir= line, add your desired directory (such as my Apache root directory/srv/ HTTP and nginx root directory/srv/nginx, and finally some of the required extension in front of the semicolon removed. 4. Edit/etc/httpd/conf/extra/php5_module.conf, add index.phtml to the DirectoryIndex line, for example: DirectoryIndex index.php index.phtml index.html 5. According to the above settings can let Apache parse PHP, if you want to use PHP-FPM, delete just joinedLoadModule php5_module modules/libphp5.so, add at the end of the/etc/httpd/conf/httpd.conf:
<filesmatch \.php$> SetHandler "proxy:unix:/run/php-fpm/php-fpm.sock|fcgi://localhost/" </FilesMatch ><ifmodule dir_module> directoryindex index.php index.html</ifmodule>
Then systemctl restart Httpd.service php-fpm.service Restart the service.
6. Edit/etc/nginx/nginx.conf, first change the user line to user HTTP HTTP, and then modify the server column as follows:
server { listen ; server_name localhost; Root/srv/nginx; Location/{ index index.html index.htm index.php; } Error_page 502 503 504 /50x.html; Location =/50x.html { root /usr/share/nginx/html; } Location ~ \.php$ { Fastcgi_pass unix:/run/php-fpm/php-fpm.sock; Fastcgi_index index.php; Include fastcgi.conf; }}
Then systemctl restart Nginx.service php-fpm.service Restart the service.
Configuring PHP, Nginx, and Apache under ArchLinux