1.Apache
重启:
sudo /usr/sbin/apachectl restart
关闭:
sudo /usr/sbin/apachectl stop
开启:
sudo /usr/sbin/apachectl start
2.Nginx
sudo nginx -s reload
3.Mysql
mysql.server restart
4.Php-fpm
sudo lsof -i:9000 //查看php-fpm端口是否在被php-fpm使用
sudo killall php-fpm // 关闭
sudo php-fpm //开启
sudo lsof -i:9000
php安装其他源
brew tap shivammathur/php
nginx 配置 *.conf
server {
listen 80;
server_name ***.cn;
rewrite ^(.*) https://***.cn$1 permanent;
charset utf-8;
root /var/www/***;
location / {
index index.html index.htm index.php;
}
location ~ \.php$ {
root /var/www/***;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
server_name ***.cn;
if ($http_host !~ "^***.cn$") {
rewrite ^(.*) https://***.cn$1 permanent;
}
listen 443 ssl;
ssl_certificate /Users/tse/Documents/cert/***.cn+4.pem;
ssl_certificate_key /Users/tse/Documents/cert/***.cn+4-key.pem;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
#ssl_ciphers HIGH:!aNULL:!MD5;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
root /var/www/***;
index index.php index.html;
location /image/data {
autoindex off;
}
location /admin {
index index.php;
}
location / {
try_files $uri @opencart;
}
location @opencart {
rewrite ^/(.+)$ /index.php?_route_=$1 last;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Make sure files with the following extensions do not get loaded by nginx because nginx would display the source code, and these files can contain PASSWORDS!
location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|twig|rar)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {
deny all;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ {
expires max;
log_not_found off;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location = /50x.html {
root html;
}
}