ubuntu安装 apache

  1. sudo su
  2. sudo apt-get update
  3. sudo apt-get upgrade
  4. sudo apt-get install apache2
  5. sudo dpkg -l | grep php| awk ‘{print $2}’ |tr “\n” ” “
  6. sudo apt-get install aptitude
  7. sudo aptitude purge `dpkg -l | grep php| awk ‘{print $2}’ |tr “\n” ” “`
  8. sudo add-apt-repository ppa:ondrej/php
  9. sudo apt-get install php5.6
  10. sudo apt-get install php5.6-gd
  11. sudo apt-get install libapache2-mod-php5.6
  12. sudo apt-get install php5.6-mysql
  13. sudo apt-get install php5.6-mbstring
  14. sudo apt-get install php5.6-mcrypt
  15. sudo apt-get install php5.6-xml
  16. sudo apt-get install php5.6-curl
  17. sudo apt-get install php5.6-dev
  18. sudo apt-get install subversion
  19. 添加vhost

复制/etc/apache2/sites-available/ 000-default.conf为aaa.cm.conf

添加

ServerName aaa.cm

ServerAdmin webmaster@localhost

DocumentRoot /data/aaa

ServerAlias www.aaa.cm

 

<Directory /data/aaa>

#CheckSpelling on

Options +Includes -Indexes

AllowOverride All

Require all granted

Allow from All

</Directory>

ln -s ../sites-available/aaa.cm.conf aaa.cm.conf

 

  1. 添加php禁用函数

打开/etc/php.ini文件,

查找到 disable_functions ,添加需禁用的函数名,如下:

phpinfo,eval,passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,fsockopen, assert

  1. 安装https

https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-18-04

  1. 安装suho

wget https://download.suhosin.org/suhosin-0.9.38.tar.gz –no-check-certificate

tar zxvf suhosin-0.9.38.tar.gz

cd suhosin-0.9.38

phpize

./config

./configure

make && make install

php.ini设置

extension_dir = “/usr/local/php/lib/php/extensions/no-debug-zts-20121212/ ”

extension=”suhosin.so”

suhosin.executor.disable_eval = on

2018-12-24
暂无评论

发表评论