linux下一些常用命令和访问目录

1. 目录

      ls   列出目录文件名
      ll    列出所有目录文件的访问权限等相关信息,包括 .   ..
      ls -a  列出所有目录文件名,包括 .   ..
    ls -l  列出目录文件的访问权限等相关信息
    ls -R  递归显示子目录结构
    ls -ld  后加目录名,显示目录和链接信息
    cd ~
    cd /
    cd ../../
    cd

2. 手动设置IP

  一、dns设置
sudo vim /etc/resolv.conf 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.1.1
nameserver 114.114.114.114
nameserver 8.8.8.8

    二、ip设置

     sudo vim /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.69
gateway 192.168.1.1
netmask 255.255.255.0

3. 查看是否启动应用

ps -ef|grep nginx
root       939     1  0 09:42 ?        00:00:00 nginx: master process ./sbin/nginx
www-data   940   939  0 09:42 ?        00:00:00 nginx: worker process
xiao      1797  1672  0 18:10 pts/3    00:00:00 grep --color=auto nginx
xiao@ubuntu:~$ ps -ef|grep php
root       889     1  0 09:42 ?        00:00:01 php-fpm: master process (/data/service/php53/etc/php-fpm.conf)
nobody     890   889  0 09:42 ?        00:00:00 php-fpm: pool www
nobody     891   889  0 09:42 ?        00:00:00 php-fpm: pool www
xiao      1799  1672  0 18:11 pts/3    00:00:00 grep --color=auto php

4. 重启和关闭nginx

   平滑启动    sudo /data/service/nginx/sbin/nginx -s reload
    关闭        sudo /data/service/nginx/sbin/nginx -s stop

5. 启动php

cd /data/service/php53/sbin/php-fpm
php 杀死主进程 

kill 889

 

6. 修改挂载命令

sudo vim /etc/rc.local

/bin/sh -c ‘cd /data/service/php53;./sbin/php-fpm;‘

/bin/sh -c ‘mount -t cifs -o username=ubuntu,password=12345,gid=65534,uid=65534 //192.168.1.25/PAPA /data/www-data/www‘

/bin/sh -c ‘mount -t cifs -o username=ubuntu,password=12345,gid=65534,uid=65534 //192.168.1.25/PAPA /home/xiao/work‘

# start nginx
/bin/sh -c ‘cd /data/service/nginx;./sbin/nginx;‘

#/bin/sh -c ‘cd /data/service/mysql; ./bin/mysqld_safe --user=mysql &‘
/bin/sh -c ‘cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &‘

exit 0

7. nginx文件配置

cd /data/service/nginx/conf/vhost/
sudo vim aa.conf
server { listen 443; server_name app.chenlu.cn; root /data/www-data/www/chenlu_api/app3; #autoindex on; ssl on; ssl_certificate /home/xiao/papa.crt; ssl_certificate_key /home/xiao/papa.key; ssl_session_timeout 5m; ssl_protocols SSLv2 SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; ssl_prefer_server_ciphers on; #charset utf-8; #access_log logs/host.access.log main; location / { index index.html index.htm index.php; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param ENV local; include fastcgi_params; } # deny access to .htaccess files, if Apache‘s document root # concurs with nginx‘s one # #location ~ /\.ht { # deny all; #a} set $rule_allow 0; if ($request_filename !~ "^.*.(gif|jpg|jpeg|png|ico|swf|css|js|txt|ttf|TTF)$"){ set $rule_allow 2$rule_allow; } if ($rule_allow = "20"){ rewrite ^/(.*) /index.php?$1 last; } }

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。