顯示具有 工作中調試環境 標籤的文章。 顯示所有文章
顯示具有 工作中調試環境 標籤的文章。 顯示所有文章

2018年3月25日 星期日

配置react -native環境

公司的新專案需要用到react-Native

上網找教學影片

後盾人孫老師錄的

整個過程非常順利,只遇到兩個小坑

1.我java安裝成第10版不支援,所以就補安裝了第8版
這邊教你怎設定環境變量
http://www.ituring.com.cn/article/207395
2.android SDK有條款沒接受
https://stackoverflow.com/questions/39760172/you-have-not-accepted-the-license-agreements-of-the-following-sdk-components

稍微注意的點:
3.文件路徑要轉譯一下變成\\雙斜線(影片有提)
4.安裝android SDK我是整個studio都載下來(跟影片不同),下一步下一步這樣安裝完成


然後設置環境變量不需要重新開機,powershell重開就行了

2018年3月18日 星期日

在centos7裡面安裝nginx+php+mysql

話不多說,直接先參考教學
http://www.smalljacky.com/linux/centos/centos7-install-setup-nginx-mariadb-php-phpmyadmin-lemp/
其餘遇到的問題列在下面


[root@www ~]# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
文章裡面的這一條會幫你建好/etc/yum.repos.d/nginx.repo這個檔案

重點是版本要對,不然會一直安裝失敗


遇到的第一個問題就是

Error: Package: nginx-1.12.2-1.el6.ngx.x86_64 (nginx)

           Requires: libpcre.so.0()(64bit)
所以安裝失敗



解決方法參考至:

This happened to me. I updated my EPEL repository with

yum update epel-release

yum install nginx

https://serverfault.com/questions/620684/cant-install-nginx-using-epel-repo-on-centos-7-64bit
--> Finished Dependency Resolution

然後就成功了
遇到的第二個問題是

systemctl start nginx

Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" f

因為port號被用走了

nginx: [emerg] bind() to 0.0.0.0:8843 failed (98: Address already in use)


解決方法參考至:

https://serverfault.com/questions/565339/nginx-fails-to-stop-and-nginx-pid-is-missing 之後80port就正常啟動了 遇到的第三個問題
改了設定檔要換port重啟的時候

 [emerg] bind() to 0.0.0.0:8843 failed (13: Permission denied)


此時就開始關心是不是防火牆的關係了,就開始到處找文章
iptables -I INPUT -p tcp --dport 8843 -j ACCEPT
然後就不小心開錯port了,要怎刪掉?

列出所有規則,前面加上行號
  • iptables -L INPUT -n --line-numbers
要刪除某一行的規則
  • iptables -D INPUT 1 # 若只有上述那行,那就是 1
  • iptables -D INPUT 3 # 若有多行,只要刪除第三行
參考至:https://blog.longwin.com.tw/2016/07/iptables-delete-rule-by-line-2016/
然後開了還是不行,結果是selinux 的問題,要關掉....
或者加port進去該軟體
http://n.sfs.tw/mymedia/index/10393
解決方法參考至:
http://blog.51cto.com/liuqh/1839889
最後終於正常重啟了QQ

第4個問題mariadb安裝完之後,改port號
同樣參考至:http://n.sfs.tw/mymedia/index/10393

第5個問題
改完port號之後遠端不能登入
mysql> GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'%' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION

參考至:
https://stackoverflow.com/questions/25777943/failed-to-connect-to-mysql-at-127-0-0-13306-with-user-root-access-denied-for-us
https://stackoverflow.com/questions/8348506/grant-remote-access-of-mysql-database-from-any-ip-address


再來又遇到 /var/run/php-fpm/php-fpm.sock failed (2: No such file or directory)
重開服務,解決
systemctl restart php-fpm

2017年11月22日 星期三

跨域的請求會請求兩次?

為什打開F12我的請求會有兩次,爾且第二次才有回應?


In 
CORS, a preflight request with the OPTIONS method is sent, so that the server can respond whether it is acceptable to send the request with these parameters

https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS





原來是因為ajax異步的關係

https://forums.asp.net/t/2068723.aspx?AJAX+called+twice+and+success+event+runs+second+time+

2017年11月16日 星期四

跨域請求

基於安全性的考量,當你發出的請求跟你現在網站頁面的網域不一樣時,瀏覽器是不會允許的,是為了客端使用者的安全


如果你是開發人員,在本地端你可以這樣做:
chrome设置--disable-web-security解决跨域


但是你不能要求使用者也跟你這樣做:

所以你可以在server 上面做設定
https://developer.mozilla.org/zh-TW/docs/Web/HTTP/Access_control_CORS


在不然身為開發人員的你,主機也不是你管的,但CODE是你管的:

可以用jsonp來做





https://segmentfault.com/a/1190000004682473

2017年11月15日 星期三

PUT/DELETE 被擋


新站點換新SERVER,此時有些路由被擋了,請網管關掉囉~~~


PUT/DELETE方法从语义上来讲,对资源是有破坏性的,PUT更改现有的资源,而DELETE摧毁一个资源,带有破坏性质的方法有时候会被防火墙或者IT管理人员特别关注


參考至:
http://www.bijishequ.com/detail/163617?p=56-50

安裝多個XAMPP

http://webdevzoom.com/install-run-multiple-xampp-windows/

改PORT就行囉

php slim 框架設定的router沒作用

工作的時候用slim 來做RESTful專案,然後就因為更新的XAMPP之後設定的路由就失聯啦,


結果是因為.....
Apache 从2.2升级到 Apache2.4.x 后配置文件 httpd.conf 的设置方法有了大变化

我在自己的httpd-vhosts.conf改這樣就OK囉
AllowOverride All
Require all granted

參考至:

https://oceandlnu.github.io/2016/08/25/Apache2.4%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%9D%83%E9%99%90%E8%AE%BE%E7%BD%AE%E9%97%AE%E9%A2%98/


https://blog.longwin.com.tw/2014/03/apache-22-24-upgrade-conf-2014/


https://stackoverflow.com/questions/12343466/always-get-404-error-in-slim-framework-when-omitting-index-php-in-url






這篇主要是講加上meber.php/add/1像這樣路由就成功,實際上這樣加上附檔名我也成功但是不是原本路由功能阿....好醜
https://stackoverflow.com/questions/9747640/slim-framework-always-return-404-error

chrome 開發者模式滑鼠不見的情況

工作中常會遇到一些莫名其妙的事,導致工作時間的拉長.....


上網查可能是因為顯卡,一些雜七雜八的原因
解決方法


沒有根治,只是換個做法



















打勾以後,按F12滑鼠就不會不見囉



參考至:
https://www.zhihu.com/question/48587059

這篇說的嘗試失敗.....
https://www.mobile01.com/topicdetail.php?f=743&t=4462465